Search in sources :

Example 6 with DBPConnectionType

use of org.jkiss.dbeaver.model.connection.DBPConnectionType in project dbeaver by serge-rider.

the class DataSourceProviderRegistry method saveConnectionTypes.

public void saveConnectionTypes() {
    File ctConfig = DBeaverActivator.getConfigurationFile(RegistryConstants.CONNECTION_TYPES_FILE_NAME);
    try {
        OutputStream os = new FileOutputStream(ctConfig);
        XMLBuilder xml = new XMLBuilder(os, GeneralUtils.UTF8_ENCODING);
        xml.setButify(true);
        xml.startElement(RegistryConstants.TAG_TYPES);
        for (DBPConnectionType connectionType : connectionTypes.values()) {
            xml.startElement(RegistryConstants.TAG_TYPE);
            xml.addAttribute(RegistryConstants.ATTR_ID, connectionType.getId());
            xml.addAttribute(RegistryConstants.ATTR_NAME, CommonUtils.toString(connectionType.getName()));
            xml.addAttribute(RegistryConstants.ATTR_COLOR, connectionType.getColor());
            xml.addAttribute(RegistryConstants.ATTR_DESCRIPTION, CommonUtils.toString(connectionType.getDescription()));
            xml.addAttribute(RegistryConstants.ATTR_AUTOCOMMIT, connectionType.isAutocommit());
            xml.addAttribute(RegistryConstants.ATTR_CONFIRM_EXECUTE, connectionType.isConfirmExecute());
            xml.endElement();
        }
        xml.endElement();
        xml.flush();
        os.close();
    } catch (Exception ex) {
        log.warn("Error saving drivers", ex);
    }
}
Also used : DBPConnectionType(org.jkiss.dbeaver.model.connection.DBPConnectionType) XMLBuilder(org.jkiss.utils.xml.XMLBuilder) XMLException(org.jkiss.utils.xml.XMLException)

Aggregations

DBPConnectionType (org.jkiss.dbeaver.model.connection.DBPConnectionType)6 GridData (org.eclipse.swt.layout.GridData)2 ArrayList (java.util.ArrayList)1 ColorSelector (org.eclipse.jface.preference.ColorSelector)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Color (org.eclipse.swt.graphics.Color)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 DBSObjectFilter (org.jkiss.dbeaver.model.struct.DBSObjectFilter)1 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)1 DataSourceProviderRegistry (org.jkiss.dbeaver.registry.DataSourceProviderRegistry)1 CSmartCombo (org.jkiss.dbeaver.ui.controls.CSmartCombo)1 XMLBuilder (org.jkiss.utils.xml.XMLBuilder)1 XMLException (org.jkiss.utils.xml.XMLException)1