use of org.jkiss.dbeaver.ui.controls.CustomSashForm in project dbeaver by dbeaver.
the class PostgreBackupWizardPageObjects method createControl.
@Override
public void createControl(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1);
Group objectsGroup = UIUtils.createControlGroup(composite, PostgreMessages.wizard_backup_page_object_group_object, 1, GridData.FILL_HORIZONTAL, 0);
objectsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
SashForm sash = new CustomSashForm(objectsGroup, SWT.VERTICAL);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Composite catPanel = UIUtils.createComposite(sash, 1);
catPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
schemasTable = new Table(catPanel, SWT.BORDER | SWT.CHECK);
schemasTable.addListener(SWT.Selection, event -> {
TableItem item = (TableItem) event.item;
PostgreSchema catalog = (PostgreSchema) item.getData();
if (event.detail == SWT.CHECK) {
schemasTable.select(schemasTable.indexOf(item));
checkedObjects.remove(catalog);
}
loadTables(catalog);
updateState();
});
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 50;
schemasTable.setLayoutData(gd);
Composite buttonsPanel = UIUtils.createComposite(catPanel, 3);
buttonsPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(buttonsPanel, SWT.NONE).setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
createCheckButtons(buttonsPanel, schemasTable);
}
{
Composite tablesPanel = UIUtils.createComposite(sash, 1);
tablesPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
tablesTable = new Table(tablesPanel, SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 50;
tablesTable.setLayoutData(gd);
tablesTable.addListener(SWT.Selection, event -> {
if (event.detail == SWT.CHECK) {
updateCheckedTables();
updateState();
}
});
Composite buttonsPanel = UIUtils.createComposite(tablesPanel, 3);
buttonsPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
exportViewsCheck = UIUtils.createCheckbox(buttonsPanel, PostgreMessages.wizard_backup_page_object_checkbox_show_view, false);
exportViewsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wizard.getSettings().setShowViews(exportViewsCheck.getSelection());
loadTables(null);
}
});
exportViewsCheck.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
createCheckButtons(buttonsPanel, tablesTable);
}
setControl(composite);
}
use of org.jkiss.dbeaver.ui.controls.CustomSashForm in project dbeaver by dbeaver.
the class MySQLExportWizardPageObjects method createControl.
@Override
public void createControl(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1);
Group objectsGroup = UIUtils.createControlGroup(composite, MySQLUIMessages.tools_db_export_wizard_page_settings_group_objects, 1, GridData.FILL_HORIZONTAL, 0);
objectsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
SashForm sash = new CustomSashForm(objectsGroup, SWT.VERTICAL);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Composite catPanel = UIUtils.createComposite(sash, 1);
catPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
catalogTable = new Table(catPanel, SWT.BORDER | SWT.CHECK);
catalogTable.addListener(SWT.Selection, event -> {
TableItem item = (TableItem) event.item;
if (item != null) {
MySQLCatalog catalog = (MySQLCatalog) item.getData();
if (event.detail == SWT.CHECK) {
catalogTable.select(catalogTable.indexOf(item));
checkedObjects.remove(catalog);
}
loadTables(catalog);
updateState();
}
});
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 50;
catalogTable.setLayoutData(gd);
Composite buttonsPanel = UIUtils.createComposite(catPanel, 3);
buttonsPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(buttonsPanel, SWT.NONE).setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
createCheckButtons(buttonsPanel, catalogTable);
}
{
Composite tablesPanel = UIUtils.createComposite(sash, 1);
tablesPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
tablesTable = new Table(tablesPanel, SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 50;
tablesTable.setLayoutData(gd);
tablesTable.addListener(SWT.Selection, event -> {
if (event.detail == SWT.CHECK) {
updateCheckedTables();
updateState();
}
});
Composite buttonsPanel = UIUtils.createComposite(tablesPanel, 3);
buttonsPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
exportViewsCheck = UIUtils.createCheckbox(buttonsPanel, "Show views", false);
exportViewsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wizard.getSettings().setShowViews(exportViewsCheck.getSelection());
loadTables(null);
}
});
exportViewsCheck.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
createCheckButtons(buttonsPanel, tablesTable);
}
loadSettings();
setControl(composite);
}
use of org.jkiss.dbeaver.ui.controls.CustomSashForm in project dbeaver by dbeaver.
the class ErrorPresentation method createPresentation.
@Override
public void createPresentation(@NotNull IResultSetController controller, @NotNull Composite parent) {
super.createPresentation(controller, parent);
CustomSashForm partDivider = UIUtils.createPartDivider(controller.getSite().getPart(), parent, SWT.HORIZONTAL);
partDivider.setLayoutData(new GridData(GridData.FILL_BOTH));
errorComposite = UIUtils.createComposite(partDivider, 1);
errorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
statusPart = new StatusPart(errorComposite, status);
for (Control child : errorComposite.getChildren()) {
if (child instanceof Text) {
TextEditorUtils.enableHostEditorKeyBindingsSupport(controller.getSite(), child);
}
}
sqlPanel = UIUtils.createComposite(partDivider, 1);
sqlPanel.setLayout(new FillLayout());
UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
try {
editorPanel = serviceSQL.createSQLPanel(controller.getSite(), sqlPanel, controller, "SQL", true, sqlText);
if (editorPanel instanceof TextViewer) {
textWidget = ((TextViewer) editorPanel).getTextWidget();
}
} catch (DBException e) {
textWidget = new StyledText(sqlPanel, SWT.BORDER | SWT.READ_ONLY);
textWidget.setText(sqlText);
}
try {
boolean widthSet = false;
IDialogSettings viewSettings = ResultSetUtils.getViewerSettings(SETTINGS_SECTION_ERROR_PANEL);
String errorWidth = viewSettings.get(PROP_ERROR_WIDTH);
if (errorWidth != null) {
String[] widthStrs = errorWidth.split(":");
if (widthStrs.length == 2) {
partDivider.setWeights(new int[] { Integer.parseInt(widthStrs[0]), Integer.parseInt(widthStrs[1]) });
}
widthSet = true;
}
if (!widthSet) {
partDivider.setWeights(new int[] { 700, 300 });
}
partDivider.addCustomSashFormListener((firstControlWeight, secondControlWeight) -> {
int[] weights = partDivider.getWeights();
viewSettings.put(PROP_ERROR_WIDTH, weights[0] + ":" + weights[1]);
});
} catch (Throwable e) {
log.debug(e);
}
}
Aggregations