Search in sources :

Example 1 with LocaleSelectorControl

use of org.jkiss.dbeaver.ui.controls.LocaleSelectorControl 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;
}
Also used : PropertyTreeViewer(org.jkiss.dbeaver.ui.properties.PropertyTreeViewer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) LocaleSelectorControl(org.jkiss.dbeaver.ui.controls.LocaleSelectorControl) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 LocaleSelectorControl (org.jkiss.dbeaver.ui.controls.LocaleSelectorControl)1 PropertyTreeViewer (org.jkiss.dbeaver.ui.properties.PropertyTreeViewer)1