Search in sources :

Example 56 with IDialogSettings

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

the class ResultSetViewer method savePresentationSettings.

private void savePresentationSettings() {
    IDialogSettings pSections = ResultSetUtils.getViewerSettings(SETTINGS_SECTION_PRESENTATIONS);
    for (Map.Entry<ResultSetPresentationDescriptor, PresentationSettings> pEntry : presentationSettings.entrySet()) {
        if (pEntry.getKey() == null) {
            continue;
        }
        String pId = pEntry.getKey().getId();
        PresentationSettings settings = pEntry.getValue();
        IDialogSettings pSection = UIUtils.getSettingsSection(pSections, pId);
        pSection.put("enabledPanelIds", CommonUtils.joinStrings(",", settings.enabledPanelIds));
        pSection.put("activePanelId", settings.activePanelId);
        pSection.put("panelRatio", settings.panelRatio);
        pSection.put("panelsVisible", settings.panelsVisible);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 57 with IDialogSettings

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

the class AggregateColumnsPanel method loadSettings.

private void loadSettings() {
    groupByColumns = panelSettings.getBoolean(PARAM_GROUP_BY_COLUMNS);
    IDialogSettings functionsSection = panelSettings.getSection("functions");
    if (functionsSection != null) {
        final Map<AggregateFunctionDescriptor, Integer> funcIndexes = new HashMap<>();
        for (IDialogSettings funcSection : functionsSection.getSections()) {
            String funcId = funcSection.getName();
            if (!funcSection.getBoolean("enabled")) {
                continue;
            }
            AggregateFunctionDescriptor func = FunctionsRegistry.getInstance().getFunction(funcId);
            if (func == null) {
                log.debug("Function '" + funcId + "' not found");
            } else {
                funcIndexes.put(func, funcSection.getInt("index"));
                enabledFunctions.add(func);
            }
        }
        Collections.sort(enabledFunctions, new Comparator<AggregateFunctionDescriptor>() {

            @Override
            public int compare(AggregateFunctionDescriptor o1, AggregateFunctionDescriptor o2) {
                return funcIndexes.get(o1) - funcIndexes.get(o2);
            }
        });
    }
    if (enabledFunctions.isEmpty()) {
        loadDefaultFunctions();
    }
}
Also used : AggregateFunctionDescriptor(org.jkiss.dbeaver.registry.functions.AggregateFunctionDescriptor) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 58 with IDialogSettings

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

the class DataTransferSettings method loadFrom.

void loadFrom(IRunnableContext runnableContext, IDialogSettings dialogSettings) {
    try {
        maxJobCount = dialogSettings.getInt("maxJobCount");
    } catch (NumberFormatException e) {
        maxJobCount = DEFAULT_THREADS_NUM;
    }
    String producerId = dialogSettings.get("producer");
    if (!CommonUtils.isEmpty(producerId)) {
        DataTransferNodeDescriptor producerNode = DataTransferRegistry.getInstance().getNodeById(producerId);
        if (producerNode != null) {
            this.producer = producerNode;
        }
    }
    if (consumerOptional) {
        DataTransferNodeDescriptor savedConsumer = null;
        String consumerId = dialogSettings.get("consumer");
        if (!CommonUtils.isEmpty(consumerId)) {
            DataTransferNodeDescriptor consumerNode = DataTransferRegistry.getInstance().getNodeById(consumerId);
            if (consumerNode != null) {
                savedConsumer = consumerNode;
            }
        }
        DataTransferProcessorDescriptor savedProcessor = null;
        if (savedConsumer != null) {
            String processorId = dialogSettings.get("processor");
            if (!CommonUtils.isEmpty(processorId)) {
                savedProcessor = savedConsumer.getProcessor(processorId);
            }
        }
        if (savedConsumer != null) {
            selectConsumer(savedConsumer, savedProcessor);
        }
    }
    // Load nodes' settings
    for (Map.Entry<Class, NodeSettings> entry : nodeSettings.entrySet()) {
        IDialogSettings nodeSection = DialogSettings.getOrCreateSection(dialogSettings, entry.getKey().getSimpleName());
        entry.getValue().settings.loadSettings(runnableContext, this, nodeSection);
    }
    IDialogSettings processorsSection = dialogSettings.getSection("processors");
    if (processorsSection != null) {
        for (IDialogSettings procSection : ArrayUtils.safeArray(processorsSection.getSections())) {
            String processorId = procSection.getName();
            String nodeId = procSection.get("@node");
            String propNamesId = procSection.get("@propNames");
            DataTransferNodeDescriptor node = DataTransferRegistry.getInstance().getNodeById(nodeId);
            if (node != null) {
                Map<Object, Object> props = new HashMap<>();
                DataTransferProcessorDescriptor nodeProcessor = node.getProcessor(processorId);
                if (nodeProcessor != null) {
                    for (String prop : CommonUtils.splitString(propNamesId, ',')) {
                        props.put(prop, procSection.get(prop));
                    }
                    processorPropsHistory.put(nodeProcessor, props);
                    NodeSettings nodeSettings = this.nodeSettings.get(node.getNodeClass());
                    if (nodeSettings != null) {
                    }
                }
            }
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) DataTransferNodeDescriptor(org.jkiss.dbeaver.registry.transfer.DataTransferNodeDescriptor) DataTransferProcessorDescriptor(org.jkiss.dbeaver.registry.transfer.DataTransferProcessorDescriptor)

Example 59 with IDialogSettings

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

the class DriverDownloadWizard method loadSettings.

private void loadSettings() {
    IDialogSettings section = UIUtils.getDialogSettings(DRIVER_DOWNLOAD_DIALOG_SETTINGS);
    setDialogSettings(section);
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 60 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project cubrid-manager by CUBRID.

the class CubridManagerUIPlugin method getPluginDialogSettings.

/**
	 * 
	 * Get this plugin dialog settings
	 * 
	 * @return IDialogSettings
	 */
public static IDialogSettings getPluginDialogSettings() {
    IDialogSettings dialogSettings = getDefault().getDialogSettings();
    IDialogSettings pliginDialogSettings = dialogSettings.getSection(PLUGIN_ID);
    if (pliginDialogSettings == null) {
        return dialogSettings.addNewSection(PLUGIN_ID);
    }
    return pliginDialogSettings;
}
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