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