use of org.jkiss.dbeaver.ui.properties.PropertyTreeViewer in project dbeaver by serge-rider.
the class TabbedFolderPageProperties method createControl.
@Override
public void createControl(Composite parent) {
this.boldFont = UIUtils.makeBoldFont(parent.getFont());
propertyTree = new PropertyTreeViewer(parent, SWT.NONE);
propertyTree.setExtraLabelProvider(new PropertyLabelProvider());
propertyTree.setExpandMode(PropertyTreeViewer.ExpandMode.FIRST);
PropertiesContributor.getInstance().addLazyListener(this);
curPropertySource = input.getPropertySource();
propertyTree.loadProperties(curPropertySource);
if (input.getDatabaseObject() != null) {
DBUtils.getObjectRegistry((DBSObject) curPropertySource.getEditableValue()).addDataSourceListener(this);
}
propertyTree.getControl().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
dispose();
}
});
}
use of org.jkiss.dbeaver.ui.properties.PropertyTreeViewer in project dbeaver by serge-rider.
the class TransformerSettingsDialog method createDialogArea.
@Override
protected Composite createDialogArea(Composite parent) {
Composite composite = super.createDialogArea(parent);
final DBPDataSource dataSource = viewer.getDataContainer() == null ? null : viewer.getDataContainer().getDataSource();
Collection<? extends DBPPropertyDescriptor> properties = Collections.emptyList();
final DBDAttributeTransformerDescriptor transformer;
if (dataSource != null && !CommonUtils.isEmpty(settings.getCustomTransformer())) {
transformer = dataSource.getContainer().getPlatform().getValueHandlerRegistry().getTransformer(settings.getCustomTransformer());
if (transformer != null) {
properties = transformer.getProperties();
}
} else {
transformer = null;
}
if (transformer != null) {
final Composite placeholder = UIUtils.createControlGroup(composite, "Transformer", 2, GridData.FILL_HORIZONTAL, -1);
UIUtils.createLabelText(placeholder, "Name", transformer.getName(), SWT.READ_ONLY);
Label infoLabel = UIUtils.createControlLabel(placeholder, "Info");
infoLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
final Text infoText = new Text(placeholder, SWT.READ_ONLY | SWT.WRAP);
if (transformer.getDescription() != null) {
infoText.setText(transformer.getDescription());
}
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
infoText.setLayoutData(gd);
}
Map<String, String> transformOptions = settings.getTransformOptions();
if (transformOptions == null) {
transformOptions = Collections.emptyMap();
}
propertiesEditor = new PropertyTreeViewer(composite, SWT.BORDER);
propertySource = new PropertySourceCustom(properties, transformOptions);
propertiesEditor.loadProperties(propertySource);
propertiesEditor.getControl().setFocus();
return parent;
}
use of org.jkiss.dbeaver.ui.properties.PropertyTreeViewer in project dbeaver by serge-rider.
the class ColumnInfoPanel method createPanel.
protected void createPanel(IAttributeController valueController) {
PropertyCollector infoItem = new PropertyCollector(valueController.getBinding().getMetaAttribute(), false);
infoItem.collectProperties();
valueController.getValueManager().contributeProperties(infoItem, valueController);
DBDRowIdentifier rowIdentifier = valueController.getRowIdentifier();
if (rowIdentifier != null) {
infoItem.addProperty(null, "Key", CoreMessages.controls_column_info_panel_property_key, new CellKeyInfo(valueController.getRowController(), rowIdentifier));
}
this.setLayout(new FillLayout());
{
PropertyTreeViewer propViewer = new PropertyTreeViewer(this, SWT.H_SCROLL | SWT.V_SCROLL);
propViewer.loadProperties(infoItem);
}
}
use of org.jkiss.dbeaver.ui.properties.PropertyTreeViewer in project dbeaver by serge-rider.
the class PrefPageDataFormat method createPreferenceContent.
@Override
protected Control createPreferenceContent(Composite parent) {
boldFont = UIUtils.makeBoldFont(parent.getFont());
Composite composite = UIUtils.createPlaceholder(parent, 1);
// Locale
localeSelector = new LocaleSelectorControl(composite, null);
localeSelector.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
if (event.data instanceof Locale) {
onLocaleChange((Locale) event.data);
}
}
});
// formats
{
Group formatGroup = new Group(composite, SWT.NONE);
formatGroup.setText(CoreMessages.pref_page_data_format_group_format);
formatGroup.setLayout(new GridLayout(2, false));
formatGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createControlLabel(formatGroup, CoreMessages.pref_page_data_format_label_type);
typeCombo = new Combo(formatGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
typeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
reloadFormatter();
}
});
Label propsLabel = UIUtils.createControlLabel(formatGroup, CoreMessages.pref_page_data_format_label_settingt);
propsLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
propertiesControl = new PropertyTreeViewer(formatGroup, SWT.BORDER);
propertiesControl.getControl().addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event event) {
saveFormatterProperties();
}
});
UIUtils.createControlLabel(formatGroup, CoreMessages.pref_page_data_format_label_sample);
sampleText = new Text(formatGroup, SWT.BORDER | SWT.READ_ONLY);
sampleText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
return composite;
}
use of org.jkiss.dbeaver.ui.properties.PropertyTreeViewer in project dbeaver by serge-rider.
the class StreamConsumerPageSettings method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Group generalSettings = new Group(composite, SWT.NONE);
generalSettings.setText(CoreMessages.data_transfer_wizard_settings_group_general);
gl = new GridLayout(4, false);
generalSettings.setLayout(gl);
generalSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
{
Composite formattingGroup = UIUtils.createPlaceholder(generalSettings, 3);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
formattingGroup.setLayoutData(gd);
UIUtils.createControlLabel(formattingGroup, CoreMessages.data_transfer_wizard_settings_label_formatting);
formatProfilesCombo = new Combo(formattingGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 200;
formatProfilesCombo.setLayoutData(gd);
formatProfilesCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (formatProfilesCombo.getSelectionIndex() > 0) {
settings.setFormatterProfile(DataFormatterRegistry.getInstance().getCustomProfile(UIUtils.getComboSelection(formatProfilesCombo)));
} else {
settings.setFormatterProfile(null);
}
}
});
Button profilesManageButton = new Button(formattingGroup, SWT.PUSH);
profilesManageButton.setText(CoreMessages.data_transfer_wizard_settings_button_edit);
profilesManageButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//DataFormatProfilesEditDialog dialog = new DataFormatProfilesEditDialog(getShell());
//dialog.open();
PreferenceDialog propDialog = PreferencesUtil.createPropertyDialogOn(getShell(), DataFormatterRegistry.getInstance(), PrefPageDataFormat.PAGE_ID, null, getSelectedFormatterProfile(), PreferencesUtil.OPTION_NONE);
if (propDialog != null) {
propDialog.open();
reloadFormatProfiles();
}
}
});
reloadFormatProfiles();
}
{
UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_settings_label_binaries);
lobExtractType = new Combo(generalSettings, SWT.DROP_DOWN | SWT.READ_ONLY);
lobExtractType.setItems(new String[] { CoreMessages.data_transfer_wizard_settings_binaries_item_set_to_null, CoreMessages.data_transfer_wizard_settings_binaries_item_save_to_file, CoreMessages.data_transfer_wizard_settings_binaries_item_inline });
lobExtractType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
switch(lobExtractType.getSelectionIndex()) {
case EXTRACT_LOB_SKIP:
settings.setLobExtractType(StreamConsumerSettings.LobExtractType.SKIP);
break;
case EXTRACT_LOB_FILES:
settings.setLobExtractType(StreamConsumerSettings.LobExtractType.FILES);
break;
case EXTRACT_LOB_INLINE:
settings.setLobExtractType(StreamConsumerSettings.LobExtractType.INLINE);
break;
}
updatePageCompletion();
}
});
lobEncodingLabel = UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_settings_label_encoding);
lobEncodingCombo = new Combo(generalSettings, SWT.DROP_DOWN | SWT.READ_ONLY);
lobEncodingCombo.setItems(new String[] { //$NON-NLS-1$
"Base64", //$NON-NLS-1$
"Hex", //$NON-NLS-1$
"Binary" });
lobEncodingCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
switch(lobEncodingCombo.getSelectionIndex()) {
case LOB_ENCODING_BASE64:
settings.setLobEncoding(StreamConsumerSettings.LobEncoding.BASE64);
break;
case LOB_ENCODING_HEX:
settings.setLobEncoding(StreamConsumerSettings.LobEncoding.HEX);
break;
case LOB_ENCODING_BINARY:
settings.setLobEncoding(StreamConsumerSettings.LobEncoding.BINARY);
break;
}
}
});
}
}
Group exporterSettings = new Group(composite, SWT.NONE);
exporterSettings.setText(CoreMessages.data_transfer_wizard_settings_group_exporter);
exporterSettings.setLayoutData(new GridData(GridData.FILL_BOTH));
exporterSettings.setLayout(new GridLayout(1, false));
propsEditor = new PropertyTreeViewer(exporterSettings, SWT.BORDER);
setControl(composite);
}
Aggregations