use of org.jkiss.dbeaver.ui.controls.itemlist.ItemListControl in project dbeaver by dbeaver.
the class ExasolCreateForeignKeyDialog method createPageContents.
@Override
protected Control createPageContents(Composite parent) {
final Composite panel = UIUtils.createPlaceholder(parent, 1, 5);
panel.setLayoutData(new GridData(GridData.FILL_BOTH));
{
final Composite tableGroup = UIUtils.createPlaceholder(panel, 2, 5);
tableGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createLabelText(tableGroup, CoreMessages.dialog_struct_edit_fk_label_table, ownTable.getFullyQualifiedName(DBPEvaluationContext.UI), SWT.READ_ONLY | SWT.BORDER);
final Text fkName = UIUtils.createLabelText(tableGroup, ExasolMessages.dialog_struct_edit_fk_label_fk_name, "NEW_FOREIGN_KEY");
name = fkName.getText();
fkName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
name = fkName.getText();
}
});
if (ownerTableNode != null) {
try {
createSchemaSelector(tableGroup);
} catch (Throwable e) {
log.debug("Can't create schema selector", e);
}
}
}
{
DBNNode rootNode = ownerTableNode == null ? DBeaverCore.getInstance().getNavigatorModel().getRoot() : ownerTableNode.getParentNode();
UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_fk_label_ref_table);
tableList = new ItemListControl(panel, SWT.SINGLE | SWT.SHEET | SWT.BORDER, null, rootNode, null);
tableList.loadData();
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 500;
gd.heightHint = 150;
tableList.setLayoutData(gd);
tableList.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
handleRefTableSelect(event.getSelection());
}
});
}
final Composite pkGroup = UIUtils.createPlaceholder(panel, 2);
{
pkGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
uniqueKeyCombo = UIUtils.createLabelCombo(pkGroup, CoreMessages.dialog_struct_edit_fk_combo_unik, SWT.DROP_DOWN | SWT.READ_ONLY);
uniqueKeyCombo.setEnabled(false);
uniqueKeyCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleUniqueKeySelect();
}
});
}
{
UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_fk_label_columns);
columnsTable = new Table(panel, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
columnsTable.setHeaderVisible(true);
columnsTable.setLinesVisible(true);
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 500;
gd.heightHint = 100;
columnsTable.setLayoutData(gd);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_column);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_col_type);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_ref_col);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_ref_col_type);
UIUtils.packColumns(columnsTable);
final TableEditor tableEditor = new TableEditor(columnsTable);
tableEditor.horizontalAlignment = SWT.CENTER;
tableEditor.verticalAlignment = SWT.TOP;
tableEditor.grabHorizontal = true;
tableEditor.minimumWidth = 50;
columnsTable.addMouseListener(new ColumnsMouseListener(tableEditor, columnsTable));
}
final Composite cascadeGroup = UIUtils.createPlaceholder(panel, 4, 5);
{
// Cascades
cascadeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Button enabled = UIUtils.createCheckbox(cascadeGroup, "Enable Constraint", false);
enabled.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
constEnabled = enabled.getSelection();
}
});
}
return panel;
}
use of org.jkiss.dbeaver.ui.controls.itemlist.ItemListControl in project dbeaver by dbeaver.
the class TabbedFolderPageNode method createControl.
@Override
public void createControl(Composite parent) {
itemControl = new ItemListControl(parent, SWT.SHEET, mainEditor.getSite(), node, metaNode);
// itemControl.getLayout().marginHeight = 0;
// itemControl.getLayout().marginWidth = 0;
ProgressPageControl progressControl = null;
if (mainEditor instanceof IProgressControlProvider) {
progressControl = ((IProgressControlProvider) mainEditor).getProgressControl();
}
if (progressControl != null) {
itemControl.substituteProgressPanel(progressControl);
} else {
itemControl.createProgressPanel();
}
parent.layout();
// Activate items control on focus
itemControl.getItemsViewer().getControl().addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// Update selection provider and selection
final ISelectionProvider selectionProvider = itemControl.getSelectionProvider();
if (mainEditor.getSite().getSelectionProvider() != selectionProvider) {
mainEditor.getSite().setSelectionProvider(selectionProvider);
selectionProvider.setSelection(selectionProvider.getSelection());
}
itemControl.activate(true);
// We need it to update search actions and other contributions provided by node editor
if (mainEditor.getSite() instanceof MultiPageEditorSite) {
MultiPageEditorPart multiPageEditor = ((MultiPageEditorSite) mainEditor.getSite()).getMultiPageEditor();
if (multiPageEditor.getSelectedPage() != mainEditor) {
multiPageEditor.setActiveEditor(mainEditor);
}
}
}
@Override
public void focusLost(FocusEvent e) {
itemControl.activate(false);
}
});
}
use of org.jkiss.dbeaver.ui.controls.itemlist.ItemListControl in project dbeaver by dbeaver.
the class EditForeignKeyPage method createPageContents.
@Override
protected Control createPageContents(Composite parent) {
final Composite panel = UIUtils.createPlaceholder(parent, 1, 5);
panel.setLayoutData(new GridData(GridData.FILL_BOTH));
{
final Composite tableGroup = UIUtils.createPlaceholder(panel, 2, 5);
tableGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createLabelText(tableGroup, CoreMessages.dialog_struct_edit_fk_label_table, ownTable.getFullyQualifiedName(DBPEvaluationContext.UI), SWT.READ_ONLY | SWT.BORDER);
if (ownerTableNode != null) {
try {
createSchemaSelector(tableGroup);
} catch (Throwable e) {
log.debug("Can't create schema selector", e);
}
}
}
{
DBNNode rootNode = ownerTableNode == null ? DBeaverCore.getInstance().getNavigatorModel().getRoot() : ownerTableNode.getParentNode();
UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_fk_label_ref_table);
tableList = new ItemListControl(panel, SWT.SINGLE | SWT.SHEET | SWT.BORDER, null, rootNode, null);
tableList.loadData();
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 500;
gd.heightHint = 150;
tableList.setLayoutData(gd);
tableList.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
handleRefTableSelect(event.getSelection());
}
});
}
final Composite pkGroup = UIUtils.createPlaceholder(panel, 2);
{
pkGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
uniqueKeyCombo = UIUtils.createLabelCombo(pkGroup, CoreMessages.dialog_struct_edit_fk_combo_unik, SWT.DROP_DOWN | SWT.READ_ONLY);
uniqueKeyCombo.setEnabled(false);
uniqueKeyCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleUniqueKeySelect();
}
});
}
{
UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_fk_label_columns);
columnsTable = new Table(panel, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
columnsTable.setHeaderVisible(true);
columnsTable.setLinesVisible(true);
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 500;
gd.heightHint = 100;
columnsTable.setLayoutData(gd);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_column);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_col_type);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_ref_col);
UIUtils.createTableColumn(columnsTable, SWT.LEFT, CoreMessages.dialog_struct_edit_fk_column_ref_col_type);
UIUtils.packColumns(columnsTable);
final TableEditor tableEditor = new TableEditor(columnsTable);
tableEditor.horizontalAlignment = SWT.CENTER;
tableEditor.verticalAlignment = SWT.TOP;
tableEditor.grabHorizontal = true;
tableEditor.minimumWidth = 50;
columnsTable.addMouseListener(new ColumnsMouseListener(tableEditor, columnsTable));
}
final Composite cascadeGroup = UIUtils.createPlaceholder(panel, 4, 5);
{
// Cascades
cascadeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Combo onDeleteCombo = UIUtils.createLabelCombo(cascadeGroup, CoreMessages.dialog_struct_edit_fk_combo_on_delete, SWT.DROP_DOWN | SWT.READ_ONLY);
onDeleteCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Combo onUpdateCombo = UIUtils.createLabelCombo(cascadeGroup, CoreMessages.dialog_struct_edit_fk_combo_on_update, SWT.DROP_DOWN | SWT.READ_ONLY);
onUpdateCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
for (DBSForeignKeyModifyRule modifyRule : supportedModifyRules) {
onDeleteCombo.add(modifyRule.getName());
onUpdateCombo.add(modifyRule.getName());
}
onDeleteCombo.select(0);
onUpdateCombo.select(0);
onDeleteRule = onUpdateRule = supportedModifyRules[0];
onDeleteCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onDeleteRule = supportedModifyRules[onDeleteCombo.getSelectionIndex()];
}
});
onUpdateCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onUpdateRule = supportedModifyRules[onUpdateCombo.getSelectionIndex()];
}
});
}
return panel;
}
Aggregations