Package com.dci.intellij.dbn.connection

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


        checkConnection();
        return new DBObjectRef(this);
    }

    protected void checkConnection() throws SQLException {
        ConnectionHandler connectionHandler = getConnectionHandler();
        if (connectionHandler == null) throw DynamicContentLoader.DBN_INTERRUPTED_EXCEPTION;
    }
View Full Code Here


    public EnvironmentType getEnvironmentType() {
        return getConnectionHandler().getEnvironmentType();
    }

    public DBLanguageDialect getLanguageDialect(DBLanguage language) {
        ConnectionHandler connectionHandler = getConnectionHandler();
        return connectionHandler == null ?
                SQLLanguage.INSTANCE.getMainLanguageDialect() :
                connectionHandler.getLanguageDialect(language);
    }
View Full Code Here

        }

        int index = url.indexOf("/", startIndex);

        String connectionId = url.substring(startIndex, index == -1 ? url.length() : index);
        ConnectionHandler connectionHandler = ConnectionCache.findConnectionHandler(connectionId);
        if (connectionHandler != null && !connectionHandler.isDisposed() && connectionHandler.isActive()) {
            if (index > -1) {
                StringTokenizer path = new StringTokenizer(url.substring(index + 1), ".");
                DBObject object = connectionHandler.getObjectBundle().getSchema(path.nextToken());
                if (object != null) {
                    while (path.hasMoreElements() && object != null) {
                        String token = path.nextToken();
                        if (path.hasMoreTokens()) {
                            int idx = token.indexOf("~");
                            if (idx > -1) {
                                String type = token.substring(0, idx);
                                String name = token.substring(idx + 1);
                                DBObjectType objectType = DBObjectType.getObjectType(type);
                                object = object.getChildObject(objectType, name, false);
                            } else {
                                object = object.getChildObject(token, false);
                            }
                        }
                    }
                    // object may have been deleted by another party
                    if (object != null && object.getProperties().is(DBObjectProperty.EDITABLE)) {
                        return findDatabaseFile((DBSchemaObject) object);
                    }
                }
            } else {
                return connectionHandler.getSQLConsoleFile();
            }

        }
        return null;
    }
View Full Code Here

                }
            }
            else if (contentType.isOneOf(DBContentType.CODE, DBContentType.CODE_SPEC_AND_BODY)) {

                DDLFileGeneralSettings ddlFileSettings = DDLFileSettings.getInstance(project).getGeneralSettings();
                ConnectionHandler connectionHandler = object.getConnectionHandler();
                boolean ddlFileBinding = connectionHandler.getSettings().getDetailSettings().isDdlFileBinding();
                if (ddlFileBinding && ddlFileSettings.getLookupDDLFilesEnabled().value()) {
                    List<VirtualFile> boundDDLFiles = getBoundDDLFiles();
                    if (boundDDLFiles == null || boundDDLFiles.isEmpty()) {
                        DDLFileAttachmentManager fileAttachmentManager = DDLFileAttachmentManager.getInstance(project);
                        List<VirtualFile> virtualFiles = fileAttachmentManager.lookupUnboundDDLFiles(object);
View Full Code Here

    protected Node[] nodes;
    private WeakReference<T> reference;

    public DBObjectRef(T object) {
        reference = new WeakReference<T>(object);
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        connectionId = connectionHandler == null ? null : connectionHandler.getId();

        List<DBObject> chain = new ArrayList<DBObject>();
        chain.add(object);

        DBObject parentObject = object.getParentObject();
View Full Code Here

            object = null;
            if (reference != null) {
                reference.clear();
                reference = null;
            }
            ConnectionHandler connectionHandler =
                    project == null ?
                            ConnectionCache.findConnectionHandler(connectionId) :
                            ConnectionManager.getInstance(project).getConnectionHandler(connectionId);
            if (connectionHandler != null && !connectionHandler.isDisposed() && connectionHandler.isActive()) {
                object = lookup(connectionHandler);
                if (object != null) {
                    reference = new WeakReference<T>(object);
                }
            }
View Full Code Here

    public SourceCodeOffsets getOffsets() {
        return offsets;
    }

    public PsiFile initializePsiFile(DatabaseFileViewProvider fileViewProvider, DBLanguage language) {
        ConnectionHandler connectionHandler = getConnectionHandler();

        DBSchemaObject underlyingObject = getObject();
        String parseRootId = getParseRootId();
        if (parseRootId != null) {
            DBLanguageDialect languageDialect = connectionHandler.getLanguageDialect(language);
            if (languageDialect != null) {
                DBLanguageFile file = (DBLanguageFile) languageDialect.getParserDefinition().createFile(fileViewProvider);
                file.setParseRootId(parseRootId);
                file.setUnderlyingObject(underlyingObject);
                fileViewProvider.forceCachedPsi(file);
View Full Code Here

        url = DatabaseFileSystem.createUrl(connectionHandler);
        setCharset(connectionHandler.getSettings().getDetailSettings().getCharset());
    }

    public PsiFile initializePsiFile(DatabaseFileViewProvider fileViewProvider, DBLanguage language) {
        ConnectionHandler connectionHandler = getConnectionHandler();
        if (connectionHandler != null) {
            DBLanguageDialect languageDialect = connectionHandler.getLanguageDialect(language);
            if (languageDialect != null) {
                DBLanguageFile file = (DBLanguageFile) languageDialect.getParserDefinition().createFile(fileViewProvider);
                fileViewProvider.forceCachedPsi(file);
                Document document = DocumentUtil.getDocument(fileViewProvider.getVirtualFile());
                PsiDocumentManagerImpl.cachePsi(document, file);
View Full Code Here

        Project project = event.getData(PlatformDataKeys.PROJECT);

        if (project != null) {
            ObjectsLookupSettings objectsLookupSettings = GlobalProjectSettings.getInstance(project).getNavigationSettings().getObjectsLookupSettings();
            if (objectsLookupSettings.getPromptConnectionSelection().value()) {
                ConnectionHandler singleConnectionHandler = null;
                DefaultActionGroup actionGroup = new DefaultActionGroup();

                ConnectionManager connectionManager = ConnectionManager.getInstance(project);
                List<ConnectionBundle> connectionBundles = connectionManager.getConnectionBundles();
                for (ConnectionBundle connectionBundle : connectionBundles) {
                    if (connectionBundle.getConnectionHandlers().size() > 0) {
                        if ((actionGroup.getChildrenCount() > 1)) {
                            actionGroup.addSeparator();
                        }

                        for (ConnectionHandler connectionHandler : connectionBundle.getConnectionHandlers()) {
                            SelectConnectionAction connectionAction = new SelectConnectionAction(connectionHandler);
                            actionGroup.add(connectionAction);
                            singleConnectionHandler = connectionHandler;
                        }
                    }
                }

                if (actionGroup.getChildrenCount() > 1) {
                    removeActionLock();
                    ListPopup popupBuilder = JBPopupFactory.getInstance().createActionGroupPopup(
                            "Select connection for lookup",
                            actionGroup,
                            event.getDataContext(),
                            //JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                            true,
                            true,
                            true,
                            null,
                            actionGroup.getChildrenCount(),
                            new Condition<AnAction>() {
                                public boolean value(AnAction action) {
                                    SelectConnectionAction selectConnectionAction = (SelectConnectionAction) action;
                                    return latestSelection == selectConnectionAction.connectionHandler;
                                }
                            });

                    popupBuilder.showCenteredInCurrentWindow(project);
                } else {
                    showLookupPopup(event, project, singleConnectionHandler, null);
                }
            } else {
                ConnectionManager connectionManager = ConnectionManager.getInstance(project);
                ConnectionHandler connectionHandler = connectionManager.getActiveConnection(project);
                showLookupPopup(event, project, connectionHandler, null);
            }
        }
    }
View Full Code Here

    public CompilerResult(DBSchemaObject object) {
        this.object = object;
        Connection connection = null;
        ResultSet resultSet = null;
        List<CompilerMessage> echoMessages = new ArrayList<CompilerMessage>();
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        try {
            connection = connectionHandler.getPoolConnection();
            resultSet = connectionHandler.getInterfaceProvider().getMetadataInterface().loadCompileObjectErrors(
                    object.getSchema().getName(),
                    object.getName(),
                    connection);

            while (resultSet != null && resultSet.next()) {
                CompilerMessage errorMessage = new CompilerMessage(this, resultSet);
                isError = true;
                if (errorMessage.isEcho()) {
                    echoMessages.add(errorMessage);
                } else {
                    compilerMessages.add(errorMessage);
                }

            }

        } catch (SQLException e) {
            e.printStackTrace();
        } finally{
            connectionHandler.freePoolConnection(connection);
            ConnectionUtil.closeResultSet(resultSet);
        }

        if (compilerMessages.size() == 0) {
            if (echoMessages.size() > 0) {
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.