Package com.dci.intellij.dbn.connection.config

Examples of com.dci.intellij.dbn.connection.config.ConnectionSettings


    public void readConfiguration(Element element) throws InvalidDataException {
        Element connectionsElement = element.getChild("connections");
        if (connectionsElement != null) {
            for (Object o : connectionsElement.getChildren()) {
                Element connectionElement = (Element) o;
                ConnectionSettings connectionConfig = new ConnectionSettings(this);
                connectionConfig.readConfiguration(connectionElement);
                ConnectionHandler connectionHandler = new ConnectionHandlerImpl(this, connectionConfig);
                connectionHandlers.add(connectionHandler);
            }
        }
    }
View Full Code Here


    public void writeConfiguration(Element element) throws WriteExternalException {
        Element connectionsElement = new Element("connections");
        element.addContent(connectionsElement);
        for (ConnectionHandler connectionHandler : connectionHandlers.getFullList()) {
            Element connectionElement = new Element("connection");
            ConnectionSettings connectionSettings = connectionHandler.getSettings();
            connectionSettings.writeConfiguration(connectionElement);
            connectionsElement.addContent(connectionElement);
        }
    }
View Full Code Here

        }
    }

    public static Connection connect(ConnectionHandler connectionHandler) throws SQLException {
        ConnectionStatus connectionStatus = connectionHandler.getConnectionStatus();
        ConnectionSettings connectionSettings = connectionHandler.getSettings();
        ConnectionDatabaseSettings databaseSettings = connectionSettings.getDatabaseSettings();
        ConnectionDetailSettings detailSettings = connectionSettings.getDetailSettings();
        return connect(databaseSettings, detailSettings.getProperties(), detailSettings.isAutoCommit(), connectionStatus);
    }
View Full Code Here

        Object[] configurations = list.getSelectedValues();
        try {
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            Element rootElement = new Element("connection-configurations");
            for (Object o : configurations) {
                ConnectionSettings configuration = (ConnectionSettings) o;
                Element configElement = new Element("config");
                configuration.writeConfiguration(configElement);
                rootElement.addContent(configElement);
            }

            Document document = new Document(rootElement);
            XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
View Full Code Here

                ConnectionListModel model = (ConnectionListModel) list.getModel();
                int selectedIndex = list.getSelectedIndex();
                List<Integer> selectedIndexes = new ArrayList<Integer>();
                for (Element configElement : configElements) {
                    selectedIndex++;
                    ConnectionSettings clone = new ConnectionSettings(connectionBundle);
                    clone.readConfiguration(configElement);
                    clone.getDatabaseSettings().setNew(true);
                    connectionBundle.setModified(true);

                    clone.getDatabaseSettings().setNew(true);
                    String name = clone.getDatabaseSettings().getName();
                    while (model.getConnectionConfig(name) != null) {
                        name = NamingUtil.getNextNumberedName(name, true);
                    }
                    clone.getDatabaseSettings().setName(name);
                    model.add(selectedIndex, clone);
                    selectedIndexes.add(selectedIndex);
                }

                list.setSelectedIndices(ArrayUtils.toPrimitive(selectedIndexes.toArray(new Integer[selectedIndexes.size()])));
View Full Code Here

        this.list = list;
    }

    public void actionPerformed(AnActionEvent anActionEvent) {
        connectionBundle.setModified(true);
        ConnectionSettings connectionSettings = new ConnectionSettings(connectionBundle);
        connectionSettings.getDatabaseSettings().setNew(true);
        GenericConnectionDatabaseSettings connectionConfig = (GenericConnectionDatabaseSettings) connectionSettings.getDatabaseSettings();
        connectionConfig.generateNewId();

        String name = "Connection";
        ConnectionListModel model = (ConnectionListModel) list.getModel();
        while (model.getConnectionConfig(name) != null) {
View Full Code Here

        }
    }

    public ConnectionSettings getConnectionConfig(String name) {
        for (int i=0; i< getSize(); i++){
            ConnectionSettings connectionSettings = (ConnectionSettings) getElementAt(i);
            if (connectionSettings.getDatabaseSettings().getName().equals(name)) {
                return connectionSettings;
            }
        }
        return null;
    }
View Full Code Here

    }

    public void sort(SortDirection sortDirection) {
        List<ConnectionSettings> list = new ArrayList<ConnectionSettings>();
        for (int i=0; i< getSize(); i++){
            ConnectionSettings connectionSettings = (ConnectionSettings) getElementAt(i);
            list.add(connectionSettings);
        }

        switch (sortDirection) {
            case ASCENDING: Collections.sort(list, ascComparator); break;
View Full Code Here

        this.connectionBundle = connectionBundle;
    }

    public void actionPerformed(AnActionEvent anActionEvent) {
        connectionBundle.setModified(true);
        ConnectionSettings connectionSettings = (ConnectionSettings) list.getSelectedValue();
        ConnectionListModel model = (ConnectionListModel) list.getModel();
        ConnectionSettings clone = connectionSettings.clone();
        clone.getDatabaseSettings().setNew(true);
        String name = clone.getDatabaseSettings().getName();
        while (model.getConnectionConfig(name) != null) {
            name = NamingUtil.getNextNumberedName(name, true);
        }
        clone.getDatabaseSettings().setName(name);
        int selectedIndex = list.getSelectedIndex() + 1;
        model.add(selectedIndex, clone);
        list.setSelectedIndex(selectedIndex);
    }
View Full Code Here

        } else {
            listChanged = true;
        }

        for (int i=0; i< listModel.getSize(); i++) {
            ConnectionSettings connectionSettings = (ConnectionSettings) listModel.getElementAt(i);
            connectionSettings.apply();

            ConnectionHandler connectionHandler = connectionBundle.getConnection(connectionSettings.getDatabaseSettings().getId());
            if (connectionHandler == null) {
                connectionHandler = new ConnectionHandlerImpl(connectionBundle, connectionSettings);
                connectionSettings.getDatabaseSettings().setNew(false);
            } else {
                oldConnections.remove(connectionHandler);
                ((ConnectionHandlerImpl)connectionHandler).setConnectionConfig(connectionSettings);
            }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.connection.config.ConnectionSettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.