use of org.jkiss.dbeaver.model.sql.format.tokenized.SQLFormatterTokenized in project dbeaver by serge-rider.
the class PrefPageSQLFormat method showFormatterSettings.
private void showFormatterSettings() {
if (curConfigurator != null) {
curConfigurator.saveSettings(getTargetPreferenceStore());
}
UIUtils.disposeChildControls(formatterConfigPlaceholder);
SQLFormatterDescriptor selFormatter = formatters.get(formatterSelector.getSelectionIndex());
try {
SQLFormatter sqlFormatter = selFormatter.createFormatter();
// FIXME: for now we support only predefined list of formatters
if (sqlFormatter instanceof SQLFormatterTokenized) {
curConfigurator = new SQLTokenizedFormatterConfigurationPage();
} else if (sqlFormatter instanceof SQLFormatterExternal) {
curConfigurator = new SQLExternalFormatterConfigurationPage();
} else {
curConfigurator = GeneralUtils.adapt(sqlFormatter, SQLFormatterConfigurator.class);
}
if (curConfigurator instanceof IDialogPage) {
curConfigurator.configure(selFormatter, () -> {
curConfigurator.saveSettings(getTargetPreferenceStore());
formatSQL();
});
((IDialogPage) curConfigurator).createControl(formatterConfigPlaceholder);
curConfigurator.loadSettings(getTargetPreferenceStore());
}
} catch (DBException e) {
log.error("Error creating formatter configurator", e);
setMessage(CommonUtils.toString(e.getMessage()), SWT.ICON_ERROR);
return;
}
((Composite) getControl()).layout(true, true);
if (isDataSourcePreferencePage()) {
enablePreferenceContent(useDataSourceSettings());
}
}
use of org.jkiss.dbeaver.model.sql.format.tokenized.SQLFormatterTokenized in project dbeaver by dbeaver.
the class PrefPageSQLFormat method showFormatterSettings.
private void showFormatterSettings() {
if (curConfigurator != null) {
curConfigurator.saveSettings(getTargetPreferenceStore());
}
UIUtils.disposeChildControls(formatterConfigPlaceholder);
SQLFormatterDescriptor selFormatter = formatters.get(formatterSelector.getSelectionIndex());
try {
SQLFormatter sqlFormatter = selFormatter.createFormatter();
// FIXME: for now we support only predefined list of formatters
if (sqlFormatter instanceof SQLFormatterTokenized) {
curConfigurator = new SQLTokenizedFormatterConfigurationPage();
} else if (sqlFormatter instanceof SQLFormatterExternal) {
curConfigurator = new SQLExternalFormatterConfigurationPage();
} else {
curConfigurator = GeneralUtils.adapt(sqlFormatter, SQLFormatterConfigurator.class);
}
if (curConfigurator instanceof IDialogPage) {
curConfigurator.configure(selFormatter, () -> {
curConfigurator.saveSettings(getTargetPreferenceStore());
formatSQL();
});
((IDialogPage) curConfigurator).createControl(formatterConfigPlaceholder);
curConfigurator.loadSettings(getTargetPreferenceStore());
}
} catch (DBException e) {
log.error("Error creating formatter configurator", e);
setMessage(CommonUtils.toString(e.getMessage()), SWT.ICON_ERROR);
return;
}
((Composite) getControl()).layout(true, true);
if (isDataSourcePreferencePage()) {
enablePreferenceContent(useDataSourceSettings());
}
}
Aggregations