use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class CompareObjectsPageOutput method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final CompareObjectsSettings settings = getWizard().getSettings();
{
Group reportSettings = new Group(composite, SWT.NONE);
reportSettings.setText("Report settings");
gl = new GridLayout(1, false);
reportSettings.setLayout(gl);
reportSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
showOnlyDifference = UIUtils.createCheckbox(reportSettings, "Show only differences", settings.isShowOnlyDifferences());
showOnlyDifference.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setShowOnlyDifferences(showOnlyDifference.getSelection());
}
});
}
{
Group outputSettings = new Group(composite, SWT.NONE);
outputSettings.setText("Output");
gl = new GridLayout(2, false);
outputSettings.setLayout(gl);
outputSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createControlLabel(outputSettings, "Output type");
reportTypeCombo = new Combo(outputSettings, SWT.DROP_DOWN | SWT.READ_ONLY);
for (CompareObjectsSettings.OutputType outputType : CompareObjectsSettings.OutputType.values()) {
reportTypeCombo.add(outputType.getTitle());
}
reportTypeCombo.select(settings.getOutputType().ordinal());
reportTypeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (CompareObjectsSettings.OutputType outputType : CompareObjectsSettings.OutputType.values()) {
if (outputType.ordinal() == reportTypeCombo.getSelectionIndex()) {
settings.setOutputType(outputType);
UIUtils.enableWithChildren(outputFolderText.getParent(), outputType == CompareObjectsSettings.OutputType.FILE);
break;
}
}
}
});
outputFolderText = DialogUtils.createOutputFolderChooser(outputSettings, null, null);
outputFolderText.setText(settings.getOutputFolder());
UIUtils.enableWithChildren(outputFolderText.getParent(), settings.getOutputType() == CompareObjectsSettings.OutputType.FILE);
outputFolderText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setOutputFolder(outputFolderText.getText());
}
});
}
setControl(composite);
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class ErrorEditorPartEx method createErrorPane.
private void createErrorPane(final Composite parent) {
Color bgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
Color fgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
parent.setBackground(bgColor);
parent.setForeground(fgColor);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
int spacing = 8;
int margins = 8;
layout.marginBottom = margins;
layout.marginTop = margins;
layout.marginLeft = margins;
layout.marginRight = margins;
layout.horizontalSpacing = spacing;
layout.verticalSpacing = spacing;
parent.setLayout(layout);
Display d = Display.getCurrent();
Label imageLabel = new Label(parent, SWT.NONE);
imageLabel.setBackground(bgColor);
Image image;
switch(error.getSeverity()) {
case IStatus.ERROR:
image = d.getSystemImage(SWT.ICON_ERROR);
break;
case IStatus.WARNING:
image = d.getSystemImage(SWT.ICON_WARNING);
break;
default:
image = d.getSystemImage(SWT.ICON_INFORMATION);
break;
}
image.setBackground(bgColor);
imageLabel.setImage(image);
imageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
text.setBackground(bgColor);
text.setForeground(fgColor);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
text.setText(error.getMessage());
Composite buttonParent = new Composite(parent, SWT.NONE);
buttonParent.setBackground(parent.getBackground());
GridLayout buttonsLayout = new GridLayout();
buttonsLayout.numColumns = 2;
buttonsLayout.marginHeight = 0;
buttonsLayout.marginWidth = 0;
buttonsLayout.horizontalSpacing = 0;
buttonParent.setLayout(buttonsLayout);
detailsButton = new Button(buttonParent, SWT.PUSH);
detailsButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
showingDetails = !showingDetails;
updateDetailsText();
}
});
detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false));
updateDetailsText();
detailsArea = new Composite(parent, SWT.NONE);
detailsArea.setBackground(bgColor);
detailsArea.setForeground(fgColor);
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 3;
data.verticalSpan = 1;
detailsArea.setLayoutData(data);
detailsArea.setLayout(new FillLayout());
parent.layout(true);
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class EditIndexPage method createContentsBeforeColumns.
@Override
protected void createContentsBeforeColumns(Composite panel) {
UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_index_label_type);
final Combo typeCombo = new Combo(panel, SWT.DROP_DOWN | SWT.READ_ONLY);
typeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
for (DBSIndexType indexType : indexTypes) {
typeCombo.add(indexType.getName());
if (selectedIndexType == null) {
selectedIndexType = indexType;
}
}
typeCombo.select(0);
typeCombo.setEnabled(indexTypes.size() > 1);
typeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedIndexType = indexTypes.get(typeCombo.getSelectionIndex());
}
});
final Button uniqueButton = UIUtils.createLabelCheckbox(panel, "Unique", false);
uniqueButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
unique = uniqueButton.getSelection();
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class SelectContentPartDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText("Choose content editor");
Composite group = (Composite) super.createDialogArea(parent);
GridData gd = new GridData(GridData.FILL_BOTH);
group.setLayoutData(gd);
Label infoLabel = new Label(group, SWT.NONE);
infoLabel.setText("Content was modified in mutliple editors. Choose correct one:");
gd = new GridData(GridData.FILL_HORIZONTAL);
infoLabel.setLayoutData(gd);
final Combo combo = new Combo(group, SWT.READ_ONLY | SWT.DROP_DOWN);
gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
combo.add("");
for (IEditorPart part : dirtyParts) {
combo.add(part.getTitle());
}
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (combo.getSelectionIndex() >= 1) {
selectedPart = dirtyParts.get(combo.getSelectionIndex() - 1);
} else {
selectedPart = null;
}
getButton(IDialogConstants.OK_ID).setEnabled(selectedPart != null);
}
});
return group;
}
use of org.eclipse.swt.events.SelectionAdapter in project dbeaver by serge-rider.
the class DB2ReorgTableDialog method createControls.
@Override
protected void createControls(Composite parent) {
Group optionsGroup = UIUtils.createControlGroup(parent, DB2Messages.dialog_table_tools_options, 1, 0, 0);
optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite composite = new Composite(optionsGroup, 2);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// INPLACE
dlgInplace = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_inplace, false);
dlgInplace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgInplace.getSelection()) {
dlgTruncate.setEnabled(true);
dlgTruncate.setSelection(true);
dlgUseTempTS.setEnabled(false);
dlgIndexScan.setEnabled(false);
dlgReorgLobsTS.setEnabled(false);
dlgUseLobsTemp.setEnabled(false);
dlgResetDictionary.setEnabled(false);
dlgAccesReadWrite.setEnabled(true);
dlgAccesNo.setEnabled(false);
dlgAccesNo.setSelection(false);
dlgAccesReadWrite.setSelection(false);
dlgAccesReadOnly.setSelection(true);
} else {
dlgTruncate.setEnabled(false);
dlgTruncate.setSelection(false);
dlgUseTempTS.setEnabled(true);
dlgIndexScan.setEnabled(true);
dlgReorgLobsTS.setEnabled(true);
dlgUseLobsTemp.setEnabled(true);
dlgResetDictionary.setEnabled(true);
dlgAccesNo.setEnabled(true);
dlgAccesReadWrite.setEnabled(false);
dlgAccesReadWrite.setSelection(false);
dlgAccesReadOnly.setSelection(false);
dlgAccesNo.setSelection(true);
}
updateSQL();
}
});
UIUtils.createPlaceholder(composite, 1);
// USE INDEX
dlgUseIndex = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_useindex, false);
dlgUseIndex.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseIndex.getSelection()) {
indexesCombo.setEnabled(true);
dlgIndexScan.setEnabled(true);
} else {
indexesCombo.setEnabled(false);
dlgIndexScan.setEnabled(false);
}
updateSQL();
}
});
indexesCombo = createIndexesCombo(composite);
// INDEXSCAN
dlgIndexScan = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_useindexscan, false);
dlgIndexScan.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// TRUNCATE
dlgTruncate = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_truncate, false);
dlgTruncate.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// USE TEMP TS
dlgUseTempTS = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_usetempts, false);
dlgUseTempTS.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseTempTS.getSelection()) {
tempTSCombo.setEnabled(true);
} else {
tempTSCombo.setEnabled(false);
}
updateSQL();
}
});
tempTSCombo = createTempTablespaceCombo(composite);
// REORG LONG AND LOBS
dlgReorgLobsTS = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_reorglobs, false);
dlgReorgLobsTS.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgReorgLobsTS.getSelection()) {
dlgUseLobsTemp.setEnabled(true);
tempLobsTSCombo.setEnabled(false);
} else {
dlgUseLobsTemp.setEnabled(false);
tempLobsTSCombo.setEnabled(false);
}
updateSQL();
}
});
UIUtils.createPlaceholder(composite, 1);
// REORG LONG AND LOBS TEMP TS
dlgUseLobsTemp = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_reorglobsts, false);
dlgUseLobsTemp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (dlgUseLobsTemp.getSelection()) {
tempLobsTSCombo.setEnabled(true);
} else {
tempLobsTSCombo.setEnabled(false);
}
updateSQL();
}
});
tempLobsTSCombo = createLobsTempTablespaceCombo(composite);
// RESET DICTIONARY
dlgResetDictionary = UIUtils.createCheckbox(composite, DB2Messages.dialog_table_tools_reorg_resetdict, false);
dlgResetDictionary.addSelectionListener(SQL_CHANGE_LISTENER);
UIUtils.createPlaceholder(composite, 1);
// TABLE ACCESS
UIUtils.createLabel(composite, DB2Messages.dialog_table_tools_reorg_access_title);
Composite groupRB = new Composite(composite, SWT.NULL);
groupRB.setLayout(new RowLayout());
dlgAccesNo = new Button(groupRB, SWT.RADIO);
dlgAccesNo.setText(DB2Messages.dialog_table_tools_reorg_access_no);
dlgAccesNo.addSelectionListener(SQL_CHANGE_LISTENER);
dlgAccesReadOnly = new Button(groupRB, SWT.RADIO);
dlgAccesReadOnly.setText(DB2Messages.dialog_table_tools_reorg_access_read);
dlgAccesReadOnly.addSelectionListener(SQL_CHANGE_LISTENER);
dlgAccesReadWrite = new Button(groupRB, SWT.RADIO);
dlgAccesReadWrite.setText(DB2Messages.dialog_table_tools_reorg_access_readwrite);
dlgAccesReadWrite.addSelectionListener(SQL_CHANGE_LISTENER);
// Initial setup
dlgTruncate.setEnabled(false);
dlgIndexScan.setEnabled(false);
dlgUseLobsTemp.setEnabled(false);
tempLobsTSCombo.setEnabled(false);
dlgAccesReadWrite.setEnabled(false);
dlgAccesReadOnly.setSelection(true);
indexName = listIndexNames.isEmpty() ? null : listIndexNames.get(0);
tempTablespace = listTempTsNames.isEmpty() ? null : listTempTsNames.get(0);
lobsTablespace = listTempTsNames.isEmpty() ? null : listTempTsNames.get(0);
// Object Selector
createObjectsSelector(parent);
}
Aggregations