use of org.eclipse.swt.events.ModifyListener in project dbeaver by serge-rider.
the class FilterValueEditDialog method createMultiValueSelector.
private void createMultiValueSelector(Composite composite) {
table = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.MULTI | SWT.CHECK | SWT.FULL_SELECTION);
table.getTable().setLinesVisible(true);
table.getTable().setHeaderVisible(true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 400;
gd.heightHint = 300;
table.getTable().setLayoutData(gd);
table.setContentProvider(new ListContentProvider());
ViewerColumnController columnController = new ViewerColumnController(getClass().getName(), table);
columnController.addColumn("Value", "Value", SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return attr.getValueHandler().getValueDisplayString(attr, ((DBDLabelValuePair) element).getValue(), DBDDisplayFormat.UI);
}
});
columnController.addColumn("Description", "Row description (composed from dictionary columns)", SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return ((DBDLabelValuePair) element).getLabel();
}
});
columnController.createColumns();
MenuManager menuMgr = new MenuManager();
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
UIUtils.fillDefaultTableContextMenu(manager, table.getTable());
manager.add(new Separator());
manager.add(new Action("Select &All") {
@Override
public void run() {
for (DBDLabelValuePair row : getMultiValues()) {
table.setChecked(row, true);
}
}
});
manager.add(new Action("Select &None") {
@Override
public void run() {
for (DBDLabelValuePair row : getMultiValues()) {
table.setChecked(row, false);
}
}
});
}
});
menuMgr.setRemoveAllWhenShown(true);
table.getTable().setMenu(menuMgr.createContextMenu(table.getTable()));
if (attr.getDataKind() == DBPDataKind.STRING) {
// Create filter text
final Text valueFilterText = new Text(composite, SWT.BORDER);
valueFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
valueFilterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
filterPattern = valueFilterText.getText();
if (filterPattern.isEmpty()) {
filterPattern = null;
}
loadValues();
}
});
}
filterPattern = null;
loadValues();
}
use of org.eclipse.swt.events.ModifyListener in project dbeaver by serge-rider.
the class ConfigImportWizardPageCustomSettings method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = new Composite(parent, SWT.NONE);
placeholder.setLayout(new GridLayout(1, true));
Composite typeGroup = UIUtils.createControlGroup(placeholder, "Input type", 2, GridData.FILL_HORIZONTAL, SWT.DEFAULT);
xmlButton = new Button(typeGroup, SWT.RADIO);
xmlButton.setText("XML");
xmlButton.setSelection(true);
csvButton = new Button(typeGroup, SWT.RADIO);
csvButton.setText("CSV");
UIUtils.createControlLabel(placeholder, "Input file");
filePathText = new TextWithOpenFile(placeholder, "Configuration Input File", new String[] { "*", "*.csv", "*.xml", "*.*" });
filePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
filePathText.getTextControl().addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
inputFile = new File(filePathText.getText());
if (!inputFile.exists()) {
setErrorMessage("File '" + inputFile.getAbsolutePath() + "' doesn't exist");
} else {
setErrorMessage(null);
}
getWizard().getContainer().updateButtons();
}
});
UIUtils.createControlLabel(placeholder, "File encoding");
encodingCombo = UIUtils.createEncodingCombo(placeholder, GeneralUtils.DEFAULT_ENCODING);
/*
final SelectionAdapter typeListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean isCSV = csvButton.getSelection();
}
};
csvButton.addSelectionListener(typeListener);
xmlButton.addSelectionListener(typeListener);
*/
setControl(placeholder);
}
use of org.eclipse.swt.events.ModifyListener 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;
}
use of org.eclipse.swt.events.ModifyListener in project translationstudio8 by heartsome.
the class AddSearchEntryDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = SWT.DEFAULT;
gridData.widthHint = 450;
container.setLayoutData(gridData);
Composite nameSetArea = new Composite(container, SWT.NONE);
GridLayout gridLayout = new GridLayout(2, false);
nameSetArea.setLayout(gridLayout);
nameSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label nameLable = new Label(nameSetArea, SWT.NONE);
GridData gd_nameLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_nameLable.widthHint = 38;
nameLable.setLayoutData(gd_nameLable);
nameLable.setText(Messages.getString("Websearch.AddSearchEntryDialog.NameLable"));
nameText = new Text(nameSetArea, SWT.BORDER);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (style == EDIT) {
nameText.setText(searEntry.getSearchName());
}
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setOkState();
}
});
Composite urlSetArea = new Composite(container, SWT.NONE);
GridLayout gridLayout2 = new GridLayout(2, false);
urlSetArea.setLayout(gridLayout2);
urlSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label urlLable = new Label(urlSetArea, SWT.NONE);
GridData gd_urlLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_urlLable.widthHint = 38;
urlLable.setLayoutData(gd_urlLable);
urlLable.setText("URL");
urlText = new Text(urlSetArea, SWT.BORDER);
if (style == EDIT) {
urlText.setText(searEntry.getSearchUrl());
}
urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
urlText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setOkState();
}
});
Composite setArea = new Composite(container, SWT.NONE);
setArea.setLayout(new GridLayout(1, true));
setArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Group group = new Group(setArea, SWT.NONE);
group.setLayout(new GridLayout(2, true));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupTitle"));
btnYesRadioButton = new Button(group, SWT.RADIO);
btnYesRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupYes"));
btnYesRadioButton.setSelection(true);
btnYesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnNoRadioButton = new Button(group, SWT.RADIO);
btnNoRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupNo"));
btnNoRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (style == EDIT) {
btnYesRadioButton.setSelection(searEntry.isChecked());
btnNoRadioButton.setSelection(!searEntry.isChecked());
}
return container;
}
use of org.eclipse.swt.events.ModifyListener in project translationstudio8 by heartsome.
the class CreateColumnGroupDialog method createInputPanel.
private Composite createInputPanel(final Composite composite) {
final Composite row = new Composite(composite, SWT.NONE);
row.setLayout(new GridLayout(2, false));
final Label createLabel = new Label(row, SWT.NONE);
createLabel.setText("G&roup Name:");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(createLabel);
groupNameText = new Text(row, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(groupNameText);
groupNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
createButton.setEnabled(groupNameText.getText().length() > 0);
}
});
groupNameText.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
if (createButton.isEnabled()) {
doColumnGrouping();
}
}
});
return row;
}
Aggregations