use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile in project dbeaver by serge-rider.
the class DataFormatProfilesEditDialog method loadProfiles.
private void loadProfiles() {
profileList.removeAll();
List<DBDDataFormatterProfile> profiles = DataFormatterRegistry.getInstance().getCustomProfiles();
for (DBDDataFormatterProfile profile : profiles) {
profileList.add(profile.getProfileName());
}
Button deleteButton = getButton(DELETE_ID);
if (deleteButton != null) {
deleteButton.setEnabled(false);
}
}
use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile 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.model.data.DBDDataFormatterProfile in project dbeaver by serge-rider.
the class DataFormatterRegistry method saveProfiles.
private void saveProfiles() {
if (customProfiles == null) {
return;
}
File storeFile = DBeaverActivator.getConfigurationFile(CONFIG_FILE_NAME);
try (OutputStream os = new FileOutputStream(storeFile)) {
XMLBuilder xml = new XMLBuilder(os, GeneralUtils.UTF8_ENCODING);
xml.setButify(true);
xml.startElement(RegistryConstants.TAG_PROFILES);
for (DBDDataFormatterProfile profile : customProfiles) {
xml.startElement(RegistryConstants.TAG_PROFILE);
xml.addAttribute(RegistryConstants.ATTR_NAME, profile.getProfileName());
SimplePreferenceStore store = (SimplePreferenceStore) profile.getPreferenceStore();
Map<String, String> props = store.getProperties();
if (props != null) {
for (Map.Entry<String, String> entry : props.entrySet()) {
xml.startElement(RegistryConstants.TAG_PROPERTY);
xml.addAttribute(RegistryConstants.ATTR_NAME, entry.getKey());
xml.addAttribute(RegistryConstants.ATTR_VALUE, entry.getValue());
xml.endElement();
}
}
xml.endElement();
}
xml.endElement();
xml.flush();
} catch (IOException ex) {
log.warn("IO error", ex);
}
}
use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile in project dbeaver by serge-rider.
the class PrefPageDataFormat method refreshProfileList.
private void refreshProfileList() {
if (isDataSourcePreferencePage()) {
return;
}
int selectionIndex = profilesCombo.getSelectionIndex();
String oldProfile = null;
if (selectionIndex > 0) {
oldProfile = profilesCombo.getItem(selectionIndex);
}
profilesCombo.removeAll();
//$NON-NLS-1$ //$NON-NLS-2$
profilesCombo.add("<" + DataFormatterRegistry.getInstance().getGlobalProfile().getProfileName() + ">");
for (DBDDataFormatterProfile profile : DataFormatterRegistry.getInstance().getCustomProfiles()) {
profilesCombo.add(profile.getProfileName());
}
if (oldProfile != null) {
profilesCombo.setText(oldProfile);
}
if (profilesCombo.getSelectionIndex() < 0) {
profilesCombo.select(0);
}
profilesCombo.setEnabled(profilesCombo.getItemCount() >= 2);
changeProfile();
}
use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile in project dbeaver by serge-rider.
the class PrefPageDataFormat method changeProfile.
private void changeProfile() {
int selectionIndex = profilesCombo.getSelectionIndex();
if (selectionIndex < 0) {
return;
}
DBDDataFormatterProfile newProfile;
if (selectionIndex == 0) {
newProfile = getDefaultProfile();
} else {
String newProfileName = profilesCombo.getItem(selectionIndex);
newProfile = DataFormatterRegistry.getInstance().getCustomProfile(newProfileName);
}
if (newProfile != formatterProfile) {
setCurrentProfile(newProfile);
}
}
Aggregations