use of org.jkiss.dbeaver.ui.navigator.database.DatabaseObjectsSelectorPanel in project dbeaver by dbeaver.
the class SearchDataPage method createControl.
@Override
public void createControl(Composite parent) {
super.createControl(parent);
initializeDialogUnits(parent);
Composite searchGroup = new Composite(parent, SWT.NONE);
searchGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
searchGroup.setLayout(new GridLayout(3, false));
setControl(searchGroup);
UIUtils.createControlLabel(searchGroup, "String");
searchText = new Combo(searchGroup, SWT.DROP_DOWN);
searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (params.searchString != null) {
searchText.setText(params.searchString);
}
for (String history : searchHistory) {
searchText.add(history);
}
searchText.addModifyListener(e -> {
params.searchString = searchText.getText();
updateEnablement();
});
Composite optionsGroup = new SashForm(searchGroup, SWT.NONE);
GridLayout layout = new GridLayout(2, true);
layout.marginHeight = 0;
layout.marginWidth = 0;
optionsGroup.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 3;
optionsGroup.setLayoutData(gd);
{
Group databasesGroup = UIUtils.createControlGroup(optionsGroup, "Databases", 1, GridData.FILL_BOTH, 0);
databasesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
selectorPanel = new DatabaseObjectsSelectorPanel(databasesGroup, true, new RunnableContextDelegate(container.getRunnableContext())) {
@Override
protected boolean isDatabaseObjectVisible(DBSObject obj) {
if (obj instanceof DBSDataContainer && obj instanceof DBSEntity) {
if ((((DBSDataContainer) obj).getSupportedFeatures() & DBSDataContainer.DATA_SEARCH) == 0) {
return false;
}
}
return super.isDatabaseObjectVisible(obj);
}
@Override
protected void onSelectionChange(Object element) {
updateEnablement();
}
};
}
{
// new Label(searchGroup, SWT.NONE);
Composite optionsGroup2 = UIUtils.createControlGroup(optionsGroup, "Settings", 2, GridData.FILL_HORIZONTAL, 0);
optionsGroup2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
if (params.maxResults <= 0) {
params.maxResults = 10;
}
final Spinner maxResultsSpinner = UIUtils.createLabelSpinner(optionsGroup2, "Sample rows", "Maximum number of rows to search. Don't set to a big number, this might greatly reduce search performance.", params.maxResults, 1, Integer.MAX_VALUE);
maxResultsSpinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
maxResultsSpinner.addModifyListener(e -> params.maxResults = maxResultsSpinner.getSelection());
final Button caseCheckbox = UIUtils.createCheckbox(optionsGroup2, UISearchMessages.dialog_search_objects_case_sensitive, "Case sensitive search", params.caseSensitive, 2);
caseCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.caseSensitive = caseCheckbox.getSelection();
}
});
final Button fastSearchCheckbox = UIUtils.createCheckbox(optionsGroup2, "Fast search (indexed)", "Search only in indexed columns", params.fastSearch, 2);
fastSearchCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.fastSearch = fastSearchCheckbox.getSelection();
}
});
final Button searchNumbersCheckbox = UIUtils.createCheckbox(optionsGroup2, "Search in numbers", "Search in numeric columns (search value must be a number)", params.searchNumbers, 2);
searchNumbersCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.searchNumbers = searchNumbersCheckbox.getSelection();
}
});
final Button searchLOBCheckbox = UIUtils.createCheckbox(optionsGroup2, "Search in LOBs", "Search in BLOB/CLOB/binary columns", params.searchLOBs, 2);
searchLOBCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.searchLOBs = searchNumbersCheckbox.getSelection();
}
});
final Button searchForeignCheckbox = UIUtils.createCheckbox(optionsGroup2, "Search in foreign objects", "Search in foreign tables or DB links. Searching in such tables may cause performance issues.", params.searchForeignObjects, 2);
searchForeignCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.searchForeignObjects = searchForeignCheckbox.getSelection();
}
});
}
UIUtils.asyncExec(this::restoreCheckedNodes);
if (!params.selectedNodes.isEmpty()) {
selectorPanel.setSelection(params.selectedNodes);
}
selectorPanel.setEnabled(true);
}
Aggregations