Search in sources :

Example 26 with GridLayout

use of org.eclipse.swt.layout.GridLayout 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);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Example 27 with GridLayout

use of org.eclipse.swt.layout.GridLayout 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();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) DatabaseNavigatorTree(org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree) DBNResource(org.jkiss.dbeaver.model.navigator.DBNResource) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IContainer(org.eclipse.core.resources.IContainer) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 28 with GridLayout

use of org.eclipse.swt.layout.GridLayout in project dbeaver by serge-rider.

the class ColumnsMappingDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    DBPDataSource targetDataSource = settings.getTargetDataSource(mapping);
    getShell().setText("Map columns of " + mapping.getTargetName());
    boldFont = UIUtils.makeBoldFont(parent.getFont());
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    new Label(composite, SWT.NONE).setText("Source entity: " + DBUtils.getObjectFullName(mapping.getSource(), DBPEvaluationContext.UI) + " [" + mapping.getSource().getDataSource().getContainer().getName() + "]");
    new Label(composite, SWT.NONE).setText("Target entity: " + mapping.getTargetName() + " [" + (targetDataSource == null ? "?" : targetDataSource.getContainer().getName()) + "]");
    mappingViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 600;
    gd.heightHint = 300;
    mappingViewer.getTable().setLayoutData(gd);
    mappingViewer.getTable().setLinesVisible(true);
    mappingViewer.getTable().setHeaderVisible(true);
    mappingViewer.setContentProvider(new ListContentProvider());
    mappingViewer.getTable().addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.character == SWT.DEL) {
                for (TableItem item : mappingViewer.getTable().getSelection()) {
                    DatabaseMappingAttribute attribute = (DatabaseMappingAttribute) item.getData();
                    attribute.setMappingType(DatabaseMappingType.skip);
                }
                updateStatus(Status.OK_STATUS);
                mappingViewer.refresh();
            } else if (e.character == SWT.SPACE) {
                for (TableItem item : mappingViewer.getTable().getSelection()) {
                    DatabaseMappingAttribute attribute = (DatabaseMappingAttribute) item.getData();
                    attribute.setMappingType(DatabaseMappingType.existing);
                    try {
                        attribute.updateMappingType(VoidProgressMonitor.INSTANCE);
                    } catch (DBException e1) {
                        updateStatus(GeneralUtils.makeExceptionStatus(e1));
                    }
                }
                mappingViewer.refresh();
            }
        }
    });
    {
        TableViewerColumn columnSource = new TableViewerColumn(mappingViewer, SWT.LEFT);
        columnSource.setLabelProvider(new CellLabelProvider() {

            @Override
            public void update(ViewerCell cell) {
                DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) cell.getElement();
                cell.setText(DBUtils.getObjectFullName(attrMapping.getSource(), DBPEvaluationContext.UI));
                if (attrMapping.getIcon() != null) {
                    cell.setImage(DBeaverIcons.getImage(attrMapping.getIcon()));
                }
            }
        });
        columnSource.getColumn().setText("Source Column");
        columnSource.getColumn().setWidth(170);
    }
    {
        TableViewerColumn columnSourceType = new TableViewerColumn(mappingViewer, SWT.LEFT);
        columnSourceType.setLabelProvider(new CellLabelProvider() {

            @Override
            public void update(ViewerCell cell) {
                cell.setText(((DatabaseMappingAttribute) cell.getElement()).getSourceType());
            }
        });
        columnSourceType.getColumn().setText("Source Type");
        columnSourceType.getColumn().setWidth(100);
    }
    {
        TableViewerColumn columnTarget = new TableViewerColumn(mappingViewer, SWT.LEFT);
        columnTarget.setLabelProvider(new CellLabelProvider() {

            @Override
            public void update(ViewerCell cell) {
                DatabaseMappingAttribute mapping = (DatabaseMappingAttribute) cell.getElement();
                cell.setText(mapping.getTargetName());
                if (mapping.mappingType == DatabaseMappingType.unspecified) {
                    cell.setBackground(DBeaverUI.getSharedTextColors().getColor(SharedTextColors.COLOR_WARNING));
                } else {
                    cell.setBackground(null);
                }
                cell.setFont(boldFont);
            }
        });
        columnTarget.getColumn().setText("Target Column");
        columnTarget.getColumn().setWidth(170);
        columnTarget.setEditingSupport(new EditingSupport(mappingViewer) {

            @Override
            protected CellEditor getCellEditor(Object element) {
                try {
                    java.util.List<String> items = new ArrayList<>();
                    DatabaseMappingAttribute mapping = (DatabaseMappingAttribute) element;
                    if (mapping.getParent().getMappingType() == DatabaseMappingType.existing && mapping.getParent().getTarget() instanceof DBSEntity) {
                        DBSEntity parentEntity = (DBSEntity) mapping.getParent().getTarget();
                        for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(VoidProgressMonitor.INSTANCE))) {
                            items.add(attr.getName());
                        }
                    }
                    items.add(DatabaseMappingAttribute.TARGET_NAME_SKIP);
                    CustomComboBoxCellEditor editor = new CustomComboBoxCellEditor(mappingViewer.getTable(), items.toArray(new String[items.size()]), SWT.DROP_DOWN);
                    updateStatus(Status.OK_STATUS);
                    return editor;
                } catch (DBException e) {
                    updateStatus(GeneralUtils.makeExceptionStatus(e));
                    return null;
                }
            }

            @Override
            protected boolean canEdit(Object element) {
                return true;
            }

            @Override
            protected Object getValue(Object element) {
                return ((DatabaseMappingAttribute) element).getTargetName();
            }

            @Override
            protected void setValue(Object element, Object value) {
                try {
                    String name = CommonUtils.toString(value);
                    DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) element;
                    if (DatabaseMappingAttribute.TARGET_NAME_SKIP.equals(name)) {
                        attrMapping.setMappingType(DatabaseMappingType.skip);
                    } else {
                        if (attrMapping.getParent().getMappingType() == DatabaseMappingType.existing && attrMapping.getParent().getTarget() instanceof DBSEntity) {
                            DBSEntity parentEntity = (DBSEntity) attrMapping.getParent().getTarget();
                            for (DBSEntityAttribute attr : CommonUtils.safeCollection(parentEntity.getAttributes(VoidProgressMonitor.INSTANCE))) {
                                if (name.equalsIgnoreCase(attr.getName())) {
                                    attrMapping.setTarget(attr);
                                    attrMapping.setMappingType(DatabaseMappingType.existing);
                                    return;
                                }
                            }
                        }
                        attrMapping.setMappingType(DatabaseMappingType.create);
                        attrMapping.setTargetName(name);
                    }
                    updateStatus(Status.OK_STATUS);
                } catch (DBException e) {
                    updateStatus(GeneralUtils.makeExceptionStatus(e));
                } finally {
                    mappingViewer.refresh();
                }
            }
        });
    }
    {
        TableViewerColumn columnTargetType = new TableViewerColumn(mappingViewer, SWT.LEFT);
        columnTargetType.setLabelProvider(new CellLabelProvider() {

            @Override
            public void update(ViewerCell cell) {
                DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) cell.getElement();
                DBPDataSource dataSource = settings.getTargetDataSource(attrMapping);
                cell.setText(attrMapping.getTargetType(dataSource));
                cell.setFont(boldFont);
            }
        });
        columnTargetType.getColumn().setText("Target Type");
        columnTargetType.getColumn().setWidth(100);
        columnTargetType.setEditingSupport(new EditingSupport(mappingViewer) {

            @Override
            protected CellEditor getCellEditor(Object element) {
                DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) element;
                Set<String> types = new LinkedHashSet<>();
                DBPDataSource dataSource = settings.getTargetDataSource(attrMapping);
                if (dataSource instanceof DBPDataTypeProvider) {
                    for (DBSDataType type : ((DBPDataTypeProvider) dataSource).getLocalDataTypes()) {
                        types.add(type.getName());
                    }
                }
                types.add(attrMapping.getTargetType(dataSource));
                return new CustomComboBoxCellEditor(mappingViewer.getTable(), types.toArray(new String[types.size()]), SWT.BORDER);
            }

            @Override
            protected boolean canEdit(Object element) {
                return true;
            }

            @Override
            protected Object getValue(Object element) {
                DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) element;
                return attrMapping.getTargetType(settings.getTargetDataSource(attrMapping));
            }

            @Override
            protected void setValue(Object element, Object value) {
                DatabaseMappingAttribute attrMapping = (DatabaseMappingAttribute) element;
                attrMapping.setTargetType(CommonUtils.toString(value));
                mappingViewer.refresh(element);
            }
        });
    }
    {
        TableViewerColumn columnType = new TableViewerColumn(mappingViewer, SWT.LEFT);
        columnType.setLabelProvider(new CellLabelProvider() {

            @Override
            public void update(ViewerCell cell) {
                DatabaseMappingAttribute mapping = (DatabaseMappingAttribute) cell.getElement();
                String text = "";
                switch(mapping.getMappingType()) {
                    case unspecified:
                        text = "?";
                        break;
                    case existing:
                        text = "existing";
                        break;
                    case create:
                        text = "new";
                        break;
                    case skip:
                        text = "skip";
                        break;
                }
                cell.setText(text);
            }
        });
        columnType.getColumn().setText("Mapping");
        columnType.getColumn().setWidth(60);
    }
    mappingViewer.setInput(attributeMappings);
    return parent;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DBException(org.jkiss.dbeaver.DBException) KeyAdapter(org.eclipse.swt.events.KeyAdapter) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) CustomComboBoxCellEditor(org.jkiss.dbeaver.ui.controls.CustomComboBoxCellEditor) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ListContentProvider(org.jkiss.dbeaver.ui.controls.ListContentProvider) Composite(org.eclipse.swt.widgets.Composite) DBSDataType(org.jkiss.dbeaver.model.struct.DBSDataType) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) DBSEntityAttribute(org.jkiss.dbeaver.model.struct.DBSEntityAttribute) GridData(org.eclipse.swt.layout.GridData) DBPDataTypeProvider(org.jkiss.dbeaver.model.DBPDataTypeProvider) DBSEntity(org.jkiss.dbeaver.model.struct.DBSEntity)

Example 29 with GridLayout

use of org.eclipse.swt.layout.GridLayout in project dbeaver by serge-rider.

the class DatabaseConsumerPageLoadSettings 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 DatabaseConsumerSettings settings = getWizard().getPageSettings(this, DatabaseConsumerSettings.class);
    {
        Group performanceSettings = UIUtils.createControlGroup(composite, "Performance", 4, GridData.FILL_HORIZONTAL, 0);
        final Button newConnectionCheckbox = UIUtils.createLabelCheckbox(performanceSettings, CoreMessages.data_transfer_wizard_output_checkbox_new_connection, settings.isOpenNewConnections());
        newConnectionCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setOpenNewConnections(newConnectionCheckbox.getSelection());
            }
        });
        newConnectionCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
        final Button useTransactionsCheck = UIUtils.createLabelCheckbox(performanceSettings, "Use transactions", settings.isUseTransactions());
        useTransactionsCheck.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setUseTransactions(useTransactionsCheck.getSelection());
            }
        });
        useTransactionsCheck.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
        final Spinner commitAfterEdit = UIUtils.createLabelSpinner(performanceSettings, "Commit after insert of ", settings.getCommitAfterRows(), 1, Integer.MAX_VALUE);
        commitAfterEdit.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setCommitAfterRows(commitAfterEdit.getSelection());
            }
        });
        commitAfterEdit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
    }
    {
        Group generalSettings = UIUtils.createControlGroup(composite, "General", 4, GridData.FILL_HORIZONTAL, 0);
        final Button showTableCheckbox = UIUtils.createLabelCheckbox(generalSettings, "Open table editor on finish", settings.isOpenTableOnFinish());
        showTableCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setOpenTableOnFinish(showTableCheckbox.getSelection());
            }
        });
        showTableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
    }
    setControl(composite);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 30 with GridLayout

use of org.eclipse.swt.layout.GridLayout 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);
}
Also used : ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TextContentAdapter(org.eclipse.jface.fieldassist.TextContentAdapter) SimpleContentProposalProvider(org.eclipse.jface.fieldassist.SimpleContentProposalProvider) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)1439 GridData (org.eclipse.swt.layout.GridData)1286 Composite (org.eclipse.swt.widgets.Composite)1098 Label (org.eclipse.swt.widgets.Label)617 SelectionEvent (org.eclipse.swt.events.SelectionEvent)498 Button (org.eclipse.swt.widgets.Button)481 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)429 Text (org.eclipse.swt.widgets.Text)385 Group (org.eclipse.swt.widgets.Group)374 ModifyListener (org.eclipse.swt.events.ModifyListener)164 ModifyEvent (org.eclipse.swt.events.ModifyEvent)161 Combo (org.eclipse.swt.widgets.Combo)150 TableViewer (org.eclipse.jface.viewers.TableViewer)103 Table (org.eclipse.swt.widgets.Table)102 SelectionListener (org.eclipse.swt.events.SelectionListener)94 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)76 FillLayout (org.eclipse.swt.layout.FillLayout)72 Point (org.eclipse.swt.graphics.Point)70 ArrayList (java.util.ArrayList)64 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)61