Search in sources :

Example 1 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project dbeaver by serge-rider.

the class DataTransferSettings method saveTo.

void saveTo(IDialogSettings dialogSettings) {
    dialogSettings.put("maxJobCount", maxJobCount);
    // Save nodes' settings
    for (Map.Entry<Class, NodeSettings> entry : nodeSettings.entrySet()) {
        IDialogSettings nodeSection = DialogSettings.getOrCreateSection(dialogSettings, entry.getKey().getSimpleName());
        entry.getValue().settings.saveSettings(nodeSection);
    }
    if (producer != null) {
        dialogSettings.put("producer", producer.getId());
    }
    if (consumer != null) {
        dialogSettings.put("consumer", consumer.getId());
    }
    if (processor != null) {
        dialogSettings.put("processor", processor.getId());
    }
    // Save processors' properties
    IDialogSettings processorsSection = DialogSettings.getOrCreateSection(dialogSettings, "processors");
    for (DataTransferProcessorDescriptor procDescriptor : processorPropsHistory.keySet()) {
        IDialogSettings procSettings = DialogSettings.getOrCreateSection(processorsSection, procDescriptor.getId());
        procSettings.put("@node", procDescriptor.getNode().getId());
        Map<Object, Object> props = processorPropsHistory.get(procDescriptor);
        if (props != null) {
            StringBuilder propNames = new StringBuilder();
            for (Map.Entry<Object, Object> prop : props.entrySet()) {
                propNames.append(prop.getKey()).append(',');
            }
            procSettings.put("@propNames", propNames.toString());
            for (Map.Entry<Object, Object> prop : props.entrySet()) {
                procSettings.put(CommonUtils.toString(prop.getKey()), CommonUtils.toString(prop.getValue()));
            }
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) DataTransferProcessorDescriptor(org.jkiss.dbeaver.registry.transfer.DataTransferProcessorDescriptor)

Example 2 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project dbeaver by serge-rider.

the class DataTransferWizard method loadSettings.

private void loadSettings() {
    IDialogSettings section = UIUtils.getDialogSettings(RS_EXPORT_WIZARD_DIALOG_SETTINGS);
    setDialogSettings(section);
    settings.loadFrom(DBeaverUI.getActiveWorkbenchWindow(), section);
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 3 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project dbeaver by serge-rider.

the class AggregateColumnsPanel method saveSettings.

private void saveSettings() {
    panelSettings.put(PARAM_GROUP_BY_COLUMNS, groupByColumns);
    IDialogSettings functionsSection = UIUtils.getSettingsSection(panelSettings, "functions");
    for (AggregateFunctionDescriptor func : FunctionsRegistry.getInstance().getFunctions()) {
        IDialogSettings funcSection = UIUtils.getSettingsSection(functionsSection, func.getId());
        boolean enabled = enabledFunctions.contains(func);
        funcSection.put("enabled", enabled);
        if (enabled) {
            funcSection.put("index", enabledFunctions.indexOf(func));
        } else {
            funcSection.put("index", -1);
        }
    }
}
Also used : AggregateFunctionDescriptor(org.jkiss.dbeaver.registry.functions.AggregateFunctionDescriptor) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 4 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project dbeaver by serge-rider.

the class QueryLogViewer method createColumns.

private void createColumns(boolean showConnection) {
    for (TableColumn tableColumn : logTable.getColumns()) {
        tableColumn.dispose();
    }
    columns.clear();
    final IDialogSettings dialogSettings = UIUtils.getDialogSettings(VIEWER_ID);
    int colIndex = 0;
    for (final LogColumn logColumn : ALL_COLUMNS) {
        if (!showConnection && (logColumn == COLUMN_DATA_SOURCE || logColumn == COLUMN_CONTEXT)) {
            continue;
        }
        final TableColumn tableColumn = UIUtils.createTableColumn(logTable, SWT.NONE, logColumn.title);
        tableColumn.setData(logColumn);
        final String colWidth = dialogSettings.get("column-" + logColumn.id);
        if (colWidth != null) {
            tableColumn.setWidth(Integer.parseInt(colWidth));
        } else {
            tableColumn.setWidth(logColumn.widthHint);
        }
        tableColumn.setToolTipText(logColumn.toolTip);
        final ColumnDescriptor cd = new ColumnDescriptor(logColumn, tableColumn);
        columns.add(cd);
        tableColumn.addListener(SWT.Selection, new TableColumnSortListener(logTable, colIndex));
        tableColumn.addListener(SWT.Resize, new Listener() {

            @Override
            public void handleEvent(Event event) {
                final int width = tableColumn.getWidth();
                dialogSettings.put("column-" + logColumn.id, String.valueOf(width));
            }
        });
        colIndex++;
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) TableColumnSortListener(org.jkiss.dbeaver.ui.controls.TableColumnSortListener) DBPPreferenceListener(org.jkiss.dbeaver.model.preferences.DBPPreferenceListener) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) TableColumnSortListener(org.jkiss.dbeaver.ui.controls.TableColumnSortListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 5 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project dbeaver by serge-rider.

the class ResultSetViewer method loadPresentationSettings.

private void loadPresentationSettings() {
    IDialogSettings pSections = ResultSetUtils.getViewerSettings(SETTINGS_SECTION_PRESENTATIONS);
    for (IDialogSettings pSection : ArrayUtils.safeArray(pSections.getSections())) {
        String pId = pSection.getName();
        ResultSetPresentationDescriptor presentation = ResultSetPresentationRegistry.getInstance().getPresentation(pId);
        if (presentation == null) {
            log.warn("Presentation '" + pId + "' not found. ");
            continue;
        }
        PresentationSettings settings = new PresentationSettings();
        String panelIdList = pSection.get("enabledPanelIds");
        if (panelIdList != null) {
            Collections.addAll(settings.enabledPanelIds, panelIdList.split(","));
        }
        settings.activePanelId = pSection.get("activePanelId");
        settings.panelRatio = pSection.getInt("panelRatio");
        settings.panelsVisible = pSection.getBoolean("panelsVisible");
        presentationSettings.put(presentation, settings);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Aggregations

IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)81 File (java.io.File)9 ArrayList (java.util.ArrayList)6 PersistenceException (org.talend.commons.exception.PersistenceException)6 Point (org.eclipse.swt.graphics.Point)5 Path (org.eclipse.core.runtime.Path)4 MenuItem (org.eclipse.swt.widgets.MenuItem)4 IPath (org.eclipse.core.runtime.IPath)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Combo (org.eclipse.swt.widgets.Combo)3 Composite (org.eclipse.swt.widgets.Composite)3 FileDialog (org.eclipse.swt.widgets.FileDialog)3 Widget (org.eclipse.swt.widgets.Widget)3 LocalFile (org.eclipse.core.internal.filesystem.local.LocalFile)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2