Search in sources :

Example 6 with DBDDataFormatterProfile

use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile 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);
    }
}
Also used : DBDDataFormatterProfile(org.jkiss.dbeaver.model.data.DBDDataFormatterProfile) DataFormatterRegistry(org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry)

Example 7 with DBDDataFormatterProfile

use of org.jkiss.dbeaver.model.data.DBDDataFormatterProfile in project dbeaver by serge-rider.

the class DataFormatterRegistry method createCustomProfile.

public DBDDataFormatterProfile createCustomProfile(String profileName) {
    getCustomProfiles();
    DBDDataFormatterProfile profile = new DataFormatterProfile(profileName, new CustomProfileStore());
    customProfiles.add(profile);
    saveProfiles();
    return profile;
}
Also used : DBDDataFormatterProfile(org.jkiss.dbeaver.model.data.DBDDataFormatterProfile) DBDDataFormatterProfile(org.jkiss.dbeaver.model.data.DBDDataFormatterProfile)

Aggregations

DBDDataFormatterProfile (org.jkiss.dbeaver.model.data.DBDDataFormatterProfile)7 DataFormatterRegistry (org.jkiss.dbeaver.registry.formatter.DataFormatterRegistry)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Button (org.eclipse.swt.widgets.Button)1 SimplePreferenceStore (org.jkiss.dbeaver.model.impl.preferences.SimplePreferenceStore)1 XMLBuilder (org.jkiss.utils.xml.XMLBuilder)1