Package com.dci.intellij.dbn.connection

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


        doOKAction();
        transactionManager.execute(handler, true, TransactionAction.COMMIT, TransactionAction.DISCONNECT_IDLE);
    }

    private void rollback() {
        ConnectionHandler handler = connectionHandler;
        DatabaseTransactionManager transactionManager = getTransactionManager();
        doOKAction();
        transactionManager.execute(handler, true, TransactionAction.ROLLBACK_IDLE, TransactionAction.DISCONNECT_IDLE);
    }
View Full Code Here


        doOKAction();
        transactionManager.execute(handler, true, TransactionAction.ROLLBACK_IDLE, TransactionAction.DISCONNECT_IDLE);
    }

    private void ping() {
        ConnectionHandler handler = connectionHandler;
        DatabaseTransactionManager transactionManager = getTransactionManager();
        doOKAction();
        transactionManager.execute(handler, true, TransactionAction.PING);
    }
View Full Code Here

            }
        }.start();
    }

    public void selectElement(BrowserTreeNode treeNode, boolean requestFocus) {
        ConnectionHandler connectionHandler = treeNode.getConnectionHandler();
        Filter<BrowserTreeNode> filter = connectionHandler == null ?
                DatabaseBrowserManager.getInstance(getProject()).getObjectFilter() :
                connectionHandler.getObjectFilter();

        if (filter.accepts(treeNode)) {
            targetSelection = treeNode;
            scrollToSelectedElement();
            if (requestFocus) requestFocus();
View Full Code Here

                    }.start();

                }
            } else if (lastPathEntity instanceof DBObjectBundle) {
                DBObjectBundle objectBundle = (DBObjectBundle) lastPathEntity;
                ConnectionHandler connectionHandler = objectBundle.getConnectionHandler();
                FileEditorManager fileEditorManager = FileEditorManager.getInstance(connectionHandler.getProject());
                fileEditorManager.openFile(connectionHandler.getSQLConsoleFile(), true);
            }
        }
    }
View Full Code Here

        GuiUtils.replaceJSplitPaneWithIDEASplitter(mainPanel);

        connectionsList.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                ConnectionHandler connectionHandler = (ConnectionHandler) connectionsList.getSelectedValue();
                showChangesForm(connectionHandler);
            }
        });
        connectionsList.setCellRenderer(new ListCellRenderer());
        connectionsList.setSelectedIndex(0);
View Full Code Here

    private class ListCellRenderer extends ColoredListCellRenderer {

        @Override
        protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
            ConnectionHandler connectionHandler = (ConnectionHandler) value;
            setIcon(connectionHandler.getIcon());
            append(connectionHandler.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
            UncommittedChangeBundle uncommittedChanges = connectionHandler.getUncommittedChanges();
            int changes = uncommittedChanges == null ? 0 : uncommittedChanges.size();
            append(" (" + changes + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);

        }
View Full Code Here

        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

    public static final Color DEFAULT_COLOR = new Color(218, 234, 255);

    @Override
    public Color getEditorTabColor(Project project, VirtualFile file) {
        if (file.getFileType() instanceof DBLanguageFileType) {
            ConnectionHandler connectionHandler = getConnectionHandler(file, project);
            if (connectionHandler == null) {
                return null;
            } else {
                EnvironmentSettings environmentSettings = GeneralProjectSettings.getInstance(connectionHandler.getProject()).getEnvironmentSettings();
                EnvironmentVisibilitySettings visibilitySettings = environmentSettings.getVisibilitySettings();
                EnvironmentType environmentType = connectionHandler.getEnvironmentType();
                if (file instanceof SQLConsoleFile || file instanceof DatabaseObjectFile) {
                    if (visibilitySettings.getObjectEditorTabs().value()) {
                        return environmentType == null ? null : environmentType.getColor();
                    }
                } else {
View Full Code Here

        }
    }

    private void resolveWithScopeParentLookup(DBObjectType objectType, IdentifierElementType substitutionCandidate) {
        if (substitutionCandidate.isObject()) {
            ConnectionHandler activeConnection = ref.getActiveConnection();
            if (!substitutionCandidate.isLocalReference() && activeConnection != null && !activeConnection.isVirtual()) {
                Set<DBObject> parentObjects = identifyPotentialParentObjects(objectType, null, this, this);
                if (parentObjects != null && parentObjects.size() > 0) {
                    for (DBObject parentObject : parentObjects) {
                        /*BasePsiElement probableParentObjectElement = null;
                        if (parentObject instanceof IdentifierPsiElement) {
                           IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) parentObject;
                           probableParentObjectElement =
                                   identifierPsiElement.isObject() ?
                                           identifierPsiElement :
                                           PsiUtil.resolveAliasedEntityElement(identifierPsiElement);

                           parentObject = identifierPsiElement.resolveUnderlyingObject();
                       } */

                        PsiElement referencedElement = parentObject.getChildObject(objectType, ref.getText().toString(), false);
                        if (isValidReference(referencedElement)) {
                            ref.setParent(null);
                            ref.setReferencedElement(referencedElement);
                            setElementType(substitutionCandidate);
                            return;
                        }
                    }
                }

                DBObjectBundle objectBundle = activeConnection.getObjectBundle();
                PsiElement referencedElement = objectBundle.getObject(objectType, ref.getText().toString());
                if (isValidReference(referencedElement)) {
                    ref.setParent(null);
                    ref.setReferencedElement(referencedElement);
                    setElementType(substitutionCandidate);
View Full Code Here

            // alias definitions do not have references.
            // underlying object is determined on runtime
            return null;
        }

        ConnectionHandler connectionHandler = getActiveConnection();
        if ((connectionHandler == null || connectionHandler.isVirtual()) && isObject() && isDefinition()) {
            return null;
        }
        if (ref == null) ref = new PsiResolveResult(this);
        if (ref.isDirty()) {
            //System.out.println("resolving " + getTextRange() + " " + getText());
View Full Code Here

TOP

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

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.