use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class ContentEditor method createPageContainer.
@Override
protected Composite createPageContainer(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
panel.setLayout(layout);
if (parent.getLayout() instanceof GridLayout) {
panel.setLayoutData(new GridData(GridData.FILL_BOTH));
}
{
IValueController valueController = getValueController();
assert valueController != null;
infoPanel = new ColumnInfoPanel(panel, SWT.NONE, valueController);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.exclude = true;
infoPanel.setLayoutData(gd);
infoPanel.setVisible(false);
}
Composite editotPanel = new Composite(panel, SWT.NONE);
layout = new GridLayout(1, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
editotPanel.setLayout(layout);
editotPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
return editotPanel;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class ContentEditor method toggleInfoBar.
void toggleInfoBar() {
boolean visible = infoPanel.isVisible();
visible = !visible;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.exclude = !visible;
infoPanel.setLayoutData(gd);
infoPanel.setVisible(visible);
infoPanel.getParent().layout();
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class GenerateMultiSQLDialog method createObjectsSelector.
protected void createObjectsSelector(Composite parent) {
if (selectedObjects.size() < 2) {
// Don't need it for a single object
return;
}
UIUtils.createControlLabel(parent, "Tables");
objectsTable = new Table(parent, SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 100;
objectsTable.setLayoutData(gd);
for (T table : selectedObjects) {
TableItem item = new TableItem(objectsTable, SWT.NONE);
item.setText(DBUtils.getObjectFullName(table, DBPEvaluationContext.UI));
item.setImage(DBeaverIcons.getImage(DBIcon.TREE_TABLE));
item.setChecked(true);
item.setData(table);
}
objectsTable.addSelectionListener(SQL_CHANGE_LISTENER);
objectsTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean hasChecked = !getCheckedObjects().isEmpty();
getButton(IDialogConstants.OK_ID).setEnabled(hasChecked);
getButton(IDialogConstants.DETAILS_ID).setEnabled(hasChecked);
}
});
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class SQLScriptStatusDialog method createDialogArea.
@Override
protected Composite createDialogArea(Composite parent) {
Composite composite = super.createDialogArea(parent);
objectTree = new Tree(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 500;
gd.heightHint = 200;
objectTree.setLayoutData(gd);
objectTree.setHeaderVisible(true);
objectTree.setLinesVisible(true);
TreeColumn nameColumn = new TreeColumn(objectTree, SWT.NONE);
nameColumn.setText("Object");
createStatusColumns(objectTree);
for (T object : objects) {
TreeItem item = new TreeItem(objectTree, SWT.NONE);
item.setData(object);
item.setText(0, DBUtils.getObjectFullName(object, DBPEvaluationContext.UI));
}
UIUtils.packColumns(objectTree, false, null);
Composite progressPanel = UIUtils.createPlaceholder(composite, 2, 5);
progressPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
progressBar = new ProgressBar(progressPanel, SWT.HORIZONTAL);
gd = new GridData(GridData.FILL_HORIZONTAL);
progressBar.setLayoutData(gd);
progressBar.setMinimum(0);
progressBar.setMaximum(this.objects.size());
final Button stopButton = UIUtils.createPushButton(progressPanel, null, UIUtils.getShardImage(ISharedImages.IMG_ELCL_STOP));
stopButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
job.cancel();
stopButton.setEnabled(false);
}
});
finishLabel = new Label(composite, SWT.NONE);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.exclude = true;
finishLabel.setLayoutData(gd);
finishLabel.setText("Finished");
return composite;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
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(new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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);
{
final DBeaverCore core = DBeaverCore.getInstance();
Group databasesGroup = UIUtils.createControlGroup(optionsGroup, "Databases", 1, GridData.FILL_BOTH, 0);
gd = new GridData(GridData.FILL_BOTH);
//gd.heightHint = 300;
databasesGroup.setLayoutData(gd);
final DBNProject projectNode = core.getNavigatorModel().getRoot().getProject(core.getProjectRegistry().getActiveProject());
DBNNode rootNode = projectNode == null ? core.getNavigatorModel().getRoot() : projectNode.getDatabases();
dataSourceTree = new DatabaseNavigatorTree(databasesGroup, rootNode, SWT.SINGLE | SWT.CHECK);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 300;
dataSourceTree.setLayoutData(gd);
final CheckboxTreeViewer viewer = (CheckboxTreeViewer) dataSourceTree.getViewer();
viewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TreeLoadNode) {
return true;
}
if (element instanceof DBNNode) {
if (element instanceof DBNDatabaseFolder) {
DBNDatabaseFolder folder = (DBNDatabaseFolder) element;
Class<? extends DBSObject> folderItemsClass = folder.getChildrenClass();
return folderItemsClass != null && (DBSObjectContainer.class.isAssignableFrom(folderItemsClass) || DBSEntity.class.isAssignableFrom(folderItemsClass));
}
if (element instanceof DBNLocalFolder || element instanceof DBNProjectDatabases || element instanceof DBNDataSource) {
return true;
}
if (element instanceof DBSWrapper) {
DBSObject obj = ((DBSWrapper) element).getObject();
if (obj instanceof DBSObjectContainer)
return true;
if (obj instanceof DBSDataContainer && obj instanceof DBSEntity) {
if ((((DBSDataContainer) obj).getSupportedFeatures() & DBSDataContainer.DATA_SEARCH) != 0) {
return true;
}
}
}
}
return false;
}
});
checkboxTreeManager = new CheckboxTreeManager(viewer, new Class[] { DBSDataContainer.class });
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
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", params.maxResults, 1, Integer.MAX_VALUE);
maxResultsSpinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
maxResultsSpinner.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
params.maxResults = maxResultsSpinner.getSelection();
}
});
final Button caseCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, CoreMessages.dialog_search_objects_case_sensitive, params.caseSensitive);
caseCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
caseCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.caseSensitive = caseCheckbox.getSelection();
}
});
final Button fastSearchCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Fast search (indexed)", params.fastSearch);
fastSearchCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
fastSearchCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.fastSearch = fastSearchCheckbox.getSelection();
}
});
final Button searchNumbersCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Search in numbers", params.searchNumbers);
searchNumbersCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
searchNumbersCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.searchNumbers = searchNumbersCheckbox.getSelection();
}
});
final Button searchLOBCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Search in LOBs", params.searchLOBs);
searchLOBCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
searchLOBCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
params.searchLOBs = searchNumbersCheckbox.getSelection();
}
});
}
final List<DBNNode> checkedNodes = new ArrayList<>();
dataSourceTree.setEnabled(false);
try {
DBeaverUI.runInProgressDialog(new DBRRunnableWithProgress() {
@Override
public void run(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Load database nodes", 1);
try {
monitor.subTask("Load tree state");
checkedNodes.addAll(loadTreeState(monitor, store, PROP_SOURCES));
} finally {
monitor.done();
}
}
});
} catch (InvocationTargetException e) {
UIUtils.showErrorDialog(getShell(), "Data sources load", "Error loading settings", e.getTargetException());
}
if (!checkedNodes.isEmpty()) {
boolean first = true;
for (DBNNode node : checkedNodes) {
((CheckboxTreeViewer) dataSourceTree.getViewer()).setChecked(node, true);
if (first) {
dataSourceTree.getViewer().reveal(NavigatorUtils.getDataSourceNode(node));
first = false;
}
}
checkboxTreeManager.updateCheckStates();
}
updateEnablement();
dataSourceTree.setEnabled(true);
}
Aggregations