use of org.jkiss.dbeaver.runtime.properties.PropertySourceCustom in project dbeaver by dbeaver.
the class PostgreFDWConfigWizardPageConfig method refreshFDWProperties.
private void refreshFDWProperties() {
{
// Fill options
DBPDataSourceContainer targetDataSource = getWizard().getSelectedDataSource();
PostgreFDWConfigWizard.FDWInfo selectedFDW = getWizard().getSelectedFDW();
PropertySourceCustom propertySource = getWizard().getFdwPropertySource();
propertySource.setDefValueResolver(targetDataSource.getVariablesResolver(false));
propertySource.removeAll();
if (selectedFDW != null && selectedFDW.fdwDescriptor != null) {
propertySource.addProperties(selectedFDW.fdwDescriptor.getProperties());
} else if (selectedFDW != null) {
// Add some default props
propertySource.addProperty(new PropertyDescriptor(null, "host", "host", "Remote database host", false, String.class, "${host}", null));
propertySource.addProperty(new PropertyDescriptor(null, "port", "port", "Remote database port", false, String.class, "${port}", null));
propertySource.addProperty(new PropertyDescriptor(null, "dbname", "dbname", "Remote database name", false, String.class, "${database}", null));
}
propsEditor.loadProperties(propertySource);
}
}
use of org.jkiss.dbeaver.runtime.properties.PropertySourceCustom in project dbeaver by dbeaver.
the class TransformerSettingsDialog method loadTransformerSettings.
private void loadTransformerSettings(Collection<? extends DBPPropertyDescriptor> properties) {
DBVTransformSettings settings = currentAttribute == null ? null : DBVUtils.getTransformSettings(currentAttribute, false);
Map<String, Object> transformOptions = settings == null ? null : settings.getTransformOptions();
if (transformOptions == null) {
transformOptions = Collections.emptyMap();
}
propertySource = new PropertySourceCustom(properties, transformOptions);
propertiesEditor.loadProperties(propertySource);
}
use of org.jkiss.dbeaver.runtime.properties.PropertySourceCustom in project dbeaver by dbeaver.
the class MockDataSettings method loadFrom.
public void loadFrom(IDialogSettings dialogSettings) {
removeOldData = dialogSettings.getBoolean(PROP_REMOVE_OLD_DATA);
try {
rowsNumber = dialogSettings.getInt(PROP_ROWS_NUMBER);
} catch (NumberFormatException e) {
// do nothing
}
// load selected generators
selectedAttribute = dialogSettings.get(KEY_SELECTED_ATTRIBUTE);
VoidProgressMonitor voidProgressMonitor = new VoidProgressMonitor();
IDialogSettings tableSection = UIUtils.getSettingsSection(dialogSettings, entity.getName());
for (Map.Entry<String, AttributeGeneratorProperties> entry : attributeGenerators.entrySet()) {
String attributeName = entry.getKey();
IDialogSettings attributeSection = UIUtils.getSettingsSection(tableSection, attributeName);
String selectedGeneratorId = attributeSection.get(KEY_SELECTED_GENERATOR);
if (selectedGeneratorId != null) {
AttributeGeneratorProperties attrGeneratorProperties = entry.getValue();
attrGeneratorProperties.setSelectedGeneratorId(selectedGeneratorId);
attrGeneratorProperties.setPresetId(attributeSection.get(KEY_PRESET_ID));
PropertySourceCustom generatorPropertySource = attrGeneratorProperties.getGeneratorPropertySource(selectedGeneratorId);
IDialogSettings generatorSection = UIUtils.getSettingsSection(attributeSection, KEY_GENERATOR_SECTION);
if (generatorPropertySource != null) {
Map<Object, Object> properties = generatorPropertySource.getPropertiesWithDefaults();
for (Map.Entry<Object, Object> propEntry : properties.entrySet()) {
String key = (String) propEntry.getKey();
Object savedValue = UIUtils.getSectionValueWithType(generatorSection, key);
if (key.equals("nulls") && savedValue instanceof Boolean) {
// skip incorrect type TODO can be removed in the future
continue;
}
generatorPropertySource.setPropertyValue(voidProgressMonitor, propEntry.getKey(), savedValue);
}
}
}
}
}
use of org.jkiss.dbeaver.runtime.properties.PropertySourceCustom in project dbeaver by dbeaver.
the class MockDataSettings method saveTo.
void saveTo(IDialogSettings dialogSettings) {
dialogSettings.put(PROP_REMOVE_OLD_DATA, removeOldData);
dialogSettings.put(PROP_ROWS_NUMBER, rowsNumber);
// save selected generators
dialogSettings.put(KEY_SELECTED_ATTRIBUTE, selectedAttribute);
IDialogSettings tableSection = UIUtils.getSettingsSection(dialogSettings, entity.getName());
for (Map.Entry<String, AttributeGeneratorProperties> attrEntry : attributeGenerators.entrySet()) {
String attributeName = attrEntry.getKey();
AttributeGeneratorProperties attrGeneratorProperties = attrEntry.getValue();
IDialogSettings attributeSection = UIUtils.getSettingsSection(tableSection, attributeName);
String selectedGeneratorId = attrGeneratorProperties.getSelectedGeneratorId();
attributeSection.put(KEY_SELECTED_GENERATOR, selectedGeneratorId);
attributeSection.put(KEY_PRESET_ID, attrGeneratorProperties.getPresetId());
IDialogSettings generatorSection = UIUtils.getSettingsSection(attributeSection, KEY_GENERATOR_SECTION);
if (selectedGeneratorId != null) {
PropertySourceCustom generatorPropertySource = attrGeneratorProperties.getGeneratorPropertySource(selectedGeneratorId);
if (generatorPropertySource != null) {
Map<Object, Object> properties = generatorPropertySource.getPropertiesWithDefaults();
for (Map.Entry<Object, Object> propEntry : properties.entrySet()) {
UIUtils.putSectionValueWithType(generatorSection, (String) propEntry.getKey(), propEntry.getValue());
}
}
}
}
}
use of org.jkiss.dbeaver.runtime.properties.PropertySourceCustom in project dbeaver by dbeaver.
the class StreamConsumerPageSettings method activatePage.
@Override
public void activatePage() {
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
propertySource = new PropertySourceCustom(processor.getProperties(), getWizard().getSettings().getProcessorProperties());
propsEditor.loadProperties(propertySource);
switch(settings.getLobExtractType()) {
case SKIP:
lobExtractType.select(EXTRACT_LOB_SKIP);
break;
case FILES:
lobExtractType.select(EXTRACT_LOB_FILES);
break;
case INLINE:
lobExtractType.select(EXTRACT_LOB_INLINE);
break;
}
switch(settings.getLobEncoding()) {
case BASE64:
lobEncodingCombo.select(LOB_ENCODING_BASE64);
break;
case HEX:
lobEncodingCombo.select(LOB_ENCODING_HEX);
break;
case BINARY:
lobEncodingCombo.select(LOB_ENCODING_BINARY);
break;
}
updatePageCompletion();
}
Aggregations