Package com.dci.intellij.dbn.connection

Examples of com.dci.intellij.dbn.connection.ConnectionBundle


                if (document == driverLibraryTextField.getTextField().getDocument()) {
                    updateLibraryTextField();
                }

                if (document == nameTextField.getDocument()) {
                    ConnectionBundle connectionBundle = connectionConfig.getConnectionBundle();
                    connectionBundle.getSettingsEditor().getList().repaint();
                    notifyPresentationChanges();
                }
            }
        };
    }
View Full Code Here


    protected ActionListener createActionListener() {
        return new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Object source = e.getSource();
                ConnectionDatabaseSettings databaseSettings = getConfiguration();
                ConnectionBundle connectionBundle = databaseSettings.getConnectionBundle();

                if (source == testButton || source == infoButton) {
                    temporaryConfig = new GenericConnectionDatabaseSettings(connectionBundle);
                    applyChanges(temporaryConfig);
                    ConnectionManager connectionManager = ConnectionManager.getInstance(connectionBundle.getProject());

                    if (source == testButton) connectionManager.testConfigConnection(temporaryConfig, true);
                    if (source == infoButton) connectionManager.showConnectionInfo(temporaryConfig, null);
                }
                else if (source == osAuthenticationCheckBox) {
                    userTextField.setEnabled(!osAuthenticationCheckBox.isSelected());
                    passwordField.setEnabled(!osAuthenticationCheckBox.isSelected());
                    getConfiguration().setModified(true);
                } else {
                    getConfiguration().setModified(true);
                }

                if (source == activeCheckBox || source == nameTextField || source == testButton || source == infoButton) {
                    connectionBundle.getSettingsEditor().getList().repaint();
                    notifyPresentationChanges();
                }
            }
        };
    }
View Full Code Here

        }
    }

    public void itemStateChanged(ItemEvent e) {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            ConnectionBundle connectionBundle = (ConnectionBundle) e.getItem();
            switchSettingsPanel(connectionBundle);
        }
    }
View Full Code Here

        CardLayout cardLayout = (CardLayout) connectionsPanel.getLayout();
        cardLayout.show(connectionsPanel, id);
    }

    public void focusConnectionSettings(ConnectionHandler connectionHandler) {
        ConnectionBundle connectionBundle = connectionHandler.getConnectionBundle();
        modulesComboBox.setSelectedItem(connectionBundle);
        ConnectionBundleSettingsForm settingsEditor = connectionBundle.getSettingsEditor();
        if (settingsEditor != null) {
            settingsEditor.selectConnection(connectionHandler);
        }
    }
View Full Code Here

    public JPanel getComponent() {
        return mainPanel;
    }

    public void applyChanges() throws ConfigurationException {
        ConnectionBundle connectionBundle = getConfiguration();

        List<ConnectionHandler> oldConnections = new ArrayList<ConnectionHandler>(connectionBundle.getConnectionHandlers().getFullList());
        List<ConnectionHandler> newConnections = new ArrayList<ConnectionHandler>();

        boolean listChanged = false;
        ConnectionListModel listModel = (ConnectionListModel) connectionsList.getModel();
        if (oldConnections.size() == listModel.getSize()) {
            for (int i=0; i<oldConnections.size(); i++) {
                ConnectionDatabaseSettings oldConfig = oldConnections.get(i).getSettings().getDatabaseSettings();
                ConnectionDatabaseSettings newConfig = ((ConnectionSettings) listModel.get(i)).getDatabaseSettings();
                if (!oldConfig.getId().equals(newConfig.getId()) ||
                        (newConfig.getSettingsEditor() != null && newConfig.getSettingsEditor().isConnectionActive() != oldConfig.isActive())) {
                    listChanged = true;
                    break;
                }
            }
        } 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);
            }

            newConnections.add(connectionHandler);

        }
        connectionBundle.setConnectionHandlers(newConnections);

        // dispose old list
        for (ConnectionHandler connectionHandler : oldConnections) {
            connectionHandler.dispose();
        }

        if (listChanged) {
            EventManager.notify(connectionBundle.getProject(), ConnectionBundleSettingsListener.TOPIC).settingsChanged();
        }
    }
View Full Code Here

    }

    private void loadElements(List<BrowserTreeNode> nodes, BrowserTreeNode browserTreeNode) {
        if (browserTreeNode.isTreeStructureLoaded()) {
            if (browserTreeNode instanceof ConnectionBundle) {
                ConnectionBundle connectionBundle = (ConnectionBundle) browserTreeNode;
                for (ConnectionHandler connectionHandler : connectionBundle.getConnectionHandlers()){
                    DBObjectBundle objectBundle = connectionHandler.getObjectBundle();
                    loadElements(nodes, objectBundle);
                }
            }
            else {
View Full Code Here

                }
                createEmptyRow();

                append(true, getConnectionHandler().getProject().getName(), false);
                append(false, "/", false);
                ConnectionBundle connectionBundle = getConnectionHandler().getConnectionBundle();
                if (connectionBundle instanceof ModuleConnectionBundle) {
                    ModuleConnectionBundle moduleConnectionManager = (ModuleConnectionBundle) connectionBundle;
                    append(false, moduleConnectionManager.getModule().getName(), false);
                    append(false, "/", false);
                }
View Full Code Here

        } else {
            if (virtualFile != null && virtualFile.getFileType() instanceof DBLanguageFileType) {
                if (connectionHandler == null) {
                    enabled = true;
                } else {
                    ConnectionBundle connectionBundle = connectionHandler.getConnectionBundle();
                    if (connectionBundle instanceof ModuleConnectionBundle) {
                        Module currentModule = ModuleUtil.findModuleForFile(virtualFile, project);
                        Module connectionModule = ((ModuleConnectionBundle) connectionBundle).getModule();
                        enabled = connectionModule == currentModule;
                    }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.connection.ConnectionBundle

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.