use of org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry in project dbeaver by serge-rider.
the class StreamConsumerPageSettings method reloadFormatProfiles.
private void reloadFormatProfiles() {
DataFormatterRegistry registry = DataFormatterRegistry.getInstance();
formatProfilesCombo.removeAll();
formatProfilesCombo.add(CoreMessages.data_transfer_wizard_settings_listbox_formatting_item_default);
for (DBDDataFormatterProfile profile : registry.getCustomProfiles()) {
formatProfilesCombo.add(profile.getProfileName());
}
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
DBDDataFormatterProfile formatterProfile = settings.getFormatterProfile();
if (formatterProfile != null) {
if (!UIUtils.setComboSelection(formatProfilesCombo, formatterProfile.getProfileName())) {
formatProfilesCombo.select(0);
}
} else {
formatProfilesCombo.select(0);
}
}
use of org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry in project dbeaver by serge-rider.
the class StreamConsumerPageSettings method getSelectedFormatterProfile.
private Object getSelectedFormatterProfile() {
DataFormatterRegistry registry = DataFormatterRegistry.getInstance();
int selectionIndex = formatProfilesCombo.getSelectionIndex();
if (selectionIndex < 0) {
return null;
} else if (selectionIndex == 0) {
return registry.getGlobalProfile();
} else {
return registry.getCustomProfile(UIUtils.getComboSelection(formatProfilesCombo));
}
}
use of org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry in project dbeaver by serge-rider.
the class DataFormatProfilesEditDialog method buttonPressed.
@Override
protected void buttonPressed(int buttonId) {
DataFormatterRegistry registry = DataFormatterRegistry.getInstance();
if (buttonId == NEW_ID) {
String profileName = EnterNameDialog.chooseName(getShell(), CoreMessages.dialog_data_format_profiles_dialog_name_chooser_title);
if (registry.getCustomProfile(profileName) != null) {
UIUtils.showMessageBox(getShell(), CoreMessages.dialog_data_format_profiles_error_title, NLS.bind(CoreMessages.dialog_data_format_profiles_error_message, profileName), SWT.ICON_ERROR);
} else {
registry.createCustomProfile(profileName);
loadProfiles();
}
} else if (buttonId == DELETE_ID) {
int selectionIndex = profileList.getSelectionIndex();
if (selectionIndex >= 0) {
DBDDataFormatterProfile profile = registry.getCustomProfile(profileList.getItem(selectionIndex));
if (profile != null) {
if (UIUtils.confirmAction(getShell(), CoreMessages.dialog_data_format_profiles_confirm_delete_title, CoreMessages.dialog_data_format_profiles_confirm_delete_message)) {
registry.deleteCustomProfile(profile);
loadProfiles();
}
}
}
} else {
super.buttonPressed(buttonId);
}
}
Aggregations