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);
}
}
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();
}
}
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) {
}
}
}
}
}
}
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);
}
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;
}
Aggregations