use of org.eclipse.swt.events.ModifyEvent in project dbeaver by serge-rider.
the class ExasolConnectionPage method createControl.
@Override
public void createControl(Composite composite) {
setImageDescriptor(EXASOL_LOGO_IMG);
Composite control = new Composite(composite, SWT.NONE);
control.setLayout(new GridLayout(1, false));
control.setLayoutData(new GridData(GridData.FILL_BOTH));
ModifyListener textListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
evaluateURL();
}
};
{
Composite addrGroup = UIUtils.createControlGroup(control, "Database", 2, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label hostLabel = UIUtils.createControlLabel(addrGroup, "Host List");
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
hostText.addModifyListener(textListener);
backupHostLabel = UIUtils.createControlLabel(addrGroup, "Backup Host List");
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
backupHostLabel.setLayoutData(gd);
backupHostLabel.setEnabled(showBackupHosts);
backupHostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
backupHostText.setLayoutData(gd);
backupHostText.addModifyListener(textListener);
useBackupHostList = UIUtils.createLabelCheckbox(addrGroup, "Use Backup Host List", showBackupHosts);
useBackupHostList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
backupHostLabel.setEnabled(useBackupHostList.getSelection());
backupHostText.setEnabled(useBackupHostList.getSelection());
//reset text if disabled
if (!useBackupHostList.getSelection())
backupHostText.setText("");
}
});
Label portLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_port);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
portLabel.setLayoutData(gd);
portText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gd.widthHint = 40;
portText.setLayoutData(gd);
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
encryptCommunication = UIUtils.createLabelCheckbox(addrGroup, "Encrypt Communication", false);
}
{
Composite addrGroup = UIUtils.createControlGroup(control, "Security", 2, 0, 0);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
addrGroup.setLayoutData(gd);
Label usernameLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_user_name);
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
usernameText.setLayoutData(gd);
usernameText.addModifyListener(textListener);
Label passwordLabel = UIUtils.createControlLabel(addrGroup, ExasolMessages.dialog_connection_password);
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(addrGroup, SWT.BORDER | SWT.PASSWORD);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
passwordText.setLayoutData(gd);
passwordText.addModifyListener(textListener);
}
createDriverPanel(control);
setControl(control);
}
use of org.eclipse.swt.events.ModifyEvent in project dbeaver by serge-rider.
the class ScriptsExportWizardPage method createControl.
@Override
public void createControl(Composite parent) {
String outDir = DBeaverCore.getGlobalPreferenceStore().getString(PREF_SCRIPTS_EXPORT_OUT_DIR);
if (CommonUtils.isEmpty(outDir)) {
outDir = RuntimeUtils.getUserHomeDir().getAbsolutePath();
}
Composite placeholder = UIUtils.createPlaceholder(parent, 1);
placeholder.setLayout(new GridLayout(1, false));
// Project list
scriptsNavigator = new DatabaseNavigatorTree(placeholder, DBeaverCore.getInstance().getNavigatorModel().getRoot(), SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_BOTH);
scriptsNavigator.setLayoutData(gd);
CheckboxTreeViewer viewer = (CheckboxTreeViewer) scriptsNavigator.getViewer();
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateState();
}
});
scriptsNavigator.getViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return element instanceof DBNResource && ((DBNResource) element).getResource() instanceof IContainer;
}
});
// Output folder
Composite generalSettings = UIUtils.createPlaceholder(placeholder, 3);
generalSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
{
overwriteCheck = UIUtils.createCheckbox(generalSettings, CoreMessages.dialog_project_export_wizard_page_checkbox_overwrite_files, false);
gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = 3;
overwriteCheck.setLayoutData(gd);
UIUtils.createControlLabel(generalSettings, CoreMessages.dialog_project_export_wizard_page_label_directory);
directoryText = new Text(generalSettings, SWT.BORDER);
directoryText.setText(outDir);
directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
directoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateState();
}
});
Button openFolder = new Button(generalSettings, SWT.PUSH);
openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER));
openFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
dialog.setMessage(CoreMessages.dialog_project_export_wizard_page_dialog_choose_export_dir_message);
dialog.setText(CoreMessages.dialog_project_export_wizard_page_dialog_choose_export_dir_text);
String directory = directoryText.getText();
if (!CommonUtils.isEmpty(directory)) {
dialog.setFilterPath(directory);
}
directory = dialog.open();
if (directory != null) {
directoryText.setText(directory);
}
}
});
}
setControl(placeholder);
updateState();
}
use of org.eclipse.swt.events.ModifyEvent in project dbeaver by serge-rider.
the class StreamConsumerPageOutput 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 StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, CoreMessages.data_transfer_wizard_output_group_general, 5, GridData.FILL_HORIZONTAL, 0);
clipboardCheck = UIUtils.createLabelCheckbox(generalSettings, "Copy to clipboard", false);
clipboardCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 4, 1));
clipboardCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputClipboard(clipboardCheck.getSelection());
toggleClipboardOutput();
updatePageCompletion();
}
});
directoryText = DialogUtils.createOutputFolderChooser(generalSettings, null, new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setOutputFolder(directoryText.getText());
updatePageCompletion();
}
});
((GridData) directoryText.getParent().getLayoutData()).horizontalSpan = 4;
UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_output_label_file_name_pattern);
fileNameText = new Text(generalSettings, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
UIUtils.setContentProposalToolTip(fileNameText, "Output file name pattern", StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_PROJECT);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setOutputFilePattern(fileNameText.getText());
updatePageCompletion();
}
});
UIUtils.installContentProposal(fileNameText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT) }));
{
UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_output_label_encoding);
encodingCombo = UIUtils.createEncodingCombo(generalSettings, settings.getOutputEncoding());
//encodingCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 1, 1));
encodingCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
int index = encodingCombo.getSelectionIndex();
if (index >= 0) {
settings.setOutputEncoding(encodingCombo.getItem(index));
}
updatePageCompletion();
}
});
encodingBOMLabel = UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_output_label_insert_bom);
encodingBOMLabel.setToolTipText(CoreMessages.data_transfer_wizard_output_label_insert_bom_tooltip);
encodingBOMCheckbox = new Button(generalSettings, SWT.CHECK);
encodingBOMCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 1, 1));
encodingBOMCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputEncodingBOM(encodingBOMCheckbox.getSelection());
}
});
new Label(generalSettings, SWT.NONE);
}
compressCheckbox = UIUtils.createLabelCheckbox(generalSettings, CoreMessages.data_transfer_wizard_output_checkbox_compress, false);
compressCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 4, 1));
compressCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setCompressResults(compressCheckbox.getSelection());
}
});
}
{
Group resultsSettings = UIUtils.createControlGroup(composite, "Results", 2, GridData.FILL_HORIZONTAL, 0);
showFolderCheckbox = UIUtils.createCheckbox(resultsSettings, CoreMessages.data_transfer_wizard_output_checkbox_open_folder, true);
showFolderCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenFolderOnFinish(showFolderCheckbox.getSelection());
}
});
showFolderCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
execProcessCheckbox = UIUtils.createCheckbox(resultsSettings, "Execute process on finish", true);
execProcessCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setExecuteProcessOnFinish(execProcessCheckbox.getSelection());
toggleExecProcessControls();
}
});
execProcessText = new Text(resultsSettings, SWT.BORDER);
execProcessText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
execProcessText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setFinishProcessCommand(execProcessText.getText());
updatePageCompletion();
}
});
UIUtils.setContentProposalToolTip(execProcessText, "Process command line", StreamTransferConsumer.VARIABLE_FILE, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_PROJECT);
UIUtils.installContentProposal(execProcessText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_FILE) }));
}
setControl(composite);
}
use of org.eclipse.swt.events.ModifyEvent in project dbeaver by serge-rider.
the class ProjectExportWizardPage method createControl.
@Override
public void createControl(Composite parent) {
String outDir = DBeaverCore.getGlobalPreferenceStore().getString(PREF_PROJECTS_EXPORT_OUT_DIR);
if (CommonUtils.isEmpty(outDir)) {
outDir = RuntimeUtils.getUserHomeDir().getAbsolutePath();
}
Set<IProject> projectList = new LinkedHashSet<>();
final ISelection selection = DBeaverUI.getActiveWorkbenchWindow().getActivePage().getSelection();
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
for (Iterator<?> iter = ((IStructuredSelection) selection).iterator(); iter.hasNext(); ) {
Object element = iter.next();
IResource resource = RuntimeUtils.getObjectAdapter(element, IResource.class);
if (resource != null) {
projectList.add(resource.getProject());
}
}
}
if (projectList.isEmpty()) {
IProject activeProject = DBeaverCore.getInstance().getProjectRegistry().getActiveProject();
if (activeProject != null) {
projectList.add(activeProject);
}
}
Composite placeholder = UIUtils.createPlaceholder(parent, 1);
placeholder.setLayout(new GridLayout(1, false));
// Project list
projectsTable = new Table(placeholder, SWT.MULTI | SWT.CHECK | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
projectsTable.setLayoutData(gd);
projectsTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateState();
}
});
for (IProject project : DBeaverCore.getInstance().getLiveProjects()) {
final TableItem item = new TableItem(projectsTable, SWT.NONE);
item.setImage(DBeaverIcons.getImage(DBIcon.PROJECT));
item.setText(project.getName());
item.setData(project);
if (projectList.contains(project)) {
item.setChecked(true);
}
}
final Composite fileNameGroup = UIUtils.createPlaceholder(placeholder, 2);
fileNameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//$NON-NLS-2$
fileNameText = UIUtils.createLabelText(fileNameGroup, CoreMessages.dialog_project_export_wizard_start_label_output_file, null);
fileNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fileNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (!CommonUtils.equalObjects(fileNameText.getText(), getArchiveFileName(getProjectsToExport()))) {
fileNameEdited = true;
}
}
});
// Output folder
Composite generalSettings = UIUtils.createPlaceholder(placeholder, 3);
generalSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
{
UIUtils.createControlLabel(generalSettings, CoreMessages.dialog_project_export_wizard_start_label_directory);
directoryText = new Text(generalSettings, SWT.BORDER);
directoryText.setText(outDir);
directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
directoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateState();
}
});
Button openFolder = new Button(generalSettings, SWT.PUSH);
openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER));
openFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
dialog.setMessage(CoreMessages.dialog_project_export_wizard_start_dialog_directory_message);
dialog.setText(CoreMessages.dialog_project_export_wizard_start_dialog_directory_text);
String directory = directoryText.getText();
if (!CommonUtils.isEmpty(directory)) {
dialog.setFilterPath(directory);
}
directory = dialog.open();
if (directory != null) {
directoryText.setText(directory);
}
}
});
}
exportDriverCheck = UIUtils.createCheckbox(placeholder, CoreMessages.dialog_project_export_wizard_start_checkbox_libraries, false);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 3;
exportDriverCheck.setLayoutData(gd);
setControl(placeholder);
updateState();
}
use of org.eclipse.swt.events.ModifyEvent 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);
}
Aggregations