Package com.dci.intellij.dbn.connection

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


    public void detachDDLFile(VirtualFile virtualFile) {
        DBObjectRef<DBSchemaObject> objectRef = mappings.remove(virtualFile.getPath());

        // map last used connection/schema
        FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(getProject());
        ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(virtualFile);
        if (activeConnection == null) {
            DBSchemaObject schemaObject = objectRef.get();
            if (schemaObject != null) {
                ConnectionHandler connectionHandler = schemaObject.getConnectionHandler();
                DBSchema schema = schemaObject.getSchema();
                connectionMappingManager.setActiveConnection(virtualFile, connectionHandler);
                connectionMappingManager.setCurrentSchema(virtualFile, schema);
            }
        }
View Full Code Here


    public void environmentConfigChanged(String environmentTypeId) {
        FileEditorManagerImpl fileEditorManager = (FileEditorManagerImpl) FileEditorManager.getInstance(getProject());
        VirtualFile[] openFiles = fileEditorManager.getOpenFiles();
        Set<EditorsSplitters> splitters = fileEditorManager.getAllSplitters();
        for (VirtualFile virtualFile : openFiles) {
            ConnectionHandler connectionHandler = DBEditorTabColorProvider.getConnectionHandler(virtualFile, getProject());
            if (connectionHandler != null && !connectionHandler.isVirtual() && !connectionHandler.isDisposed() && connectionHandler.getSettings().getDetailSettings().getEnvironmentTypeId().equals(environmentTypeId)) {
                for (EditorsSplitters splitter : splitters) {
                    splitter.updateFileBackgroundColor(virtualFile);
                }
            }
        }
View Full Code Here

        Project project = ActionUtil.getProject(e);
        VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
        if (project != null && virtualFile != null) {
            FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(project);
            ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(virtualFile);
            if (activeConnection != null) {
                text = NamingUtil.enhanceUnderscoresForDisplay(activeConnection.getQualifiedName());
                icon = activeConnection.getIcon();
            }

            boolean isConsole = virtualFile instanceof SQLConsoleFile;
            presentation.setVisible(!isConsole);
View Full Code Here

        final PsiFile file = DocumentUtil.getFile(editor);
        if (file instanceof DBLanguageFile) {
            DBLanguageFile dbLanguageFile = (DBLanguageFile) file;
            DBLanguage dbLanguage = dbLanguageFile.getDBLanguage();
            if (dbLanguage != null) {
                ConnectionHandler connectionHandler = dbLanguageFile.getActiveConnection();
                DBLanguageSyntaxHighlighter syntaxHighlighter = getSyntaxHighlighter(dbLanguage, connectionHandler);

                EditorHighlighter editorHighlighter = HighlighterFactory.createHighlighter(syntaxHighlighter, editor.getColorsScheme());
                ((EditorEx) editor).setHighlighter(editorHighlighter);
            }
View Full Code Here

        if (psiElement instanceof ExecutablePsiElementannotateExecutable((ExecutablePsiElement) psiElement, holder); else
        if (psiElement instanceof ChameleonPsiElementannotateChameleon(psiElement, holder); else
        if (psiElement instanceof TokenPsiElement) annotateToken((TokenPsiElement) psiElement, holder)else
        if (psiElement instanceof IdentifierPsiElement) {
            IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) psiElement;
            ConnectionHandler connectionHandler = identifierPsiElement.getActiveConnection();
            if (connectionHandler != null && !connectionHandler.isVirtual()) {
                annotateIdentifier(identifierPsiElement, holder);
            }
        }

View Full Code Here

            }
        }
    }

    private boolean checkConnection(IdentifierPsiElement objectReference) {
        ConnectionHandler connectionHandler = objectReference.getActiveConnection();
        return connectionHandler != null && !connectionHandler.isVirtual() && connectionHandler.getConnectionStatus().isValid() && !connectionHandler.getLoadMonitor().isLoading();
    }
View Full Code Here

    @NotNull
    protected DefaultActionGroup createPopupActionGroup(JComponent component) {
        Project project = ActionUtil.getProject(component);
        VirtualFile virtualFile = PlatformDataKeys.VIRTUAL_FILE.getData(DataManager.getInstance().getDataContext(component));
        ConnectionHandler activeConnection = FileConnectionMappingManager.getInstance(project).getActiveConnection(virtualFile);
        DefaultActionGroup actionGroup = new DefaultActionGroup();
        if (activeConnection != null && !activeConnection.isVirtual() && !activeConnection.isDisposed()) {
            for (DBSchema schema : activeConnection.getObjectBundle().getSchemas()){
                actionGroup.add(new SetCurrentSchemaAction(schema));
            }
        }
        return actionGroup;
    }
View Full Code Here

        boolean visible = false;
        boolean enabled = true;

        if (project != null && virtualFile != null) {
            FileConnectionMappingManager mappingManager = FileConnectionMappingManager.getInstance(project);
            ConnectionHandler activeConnection = mappingManager.getActiveConnection(virtualFile);
            visible = activeConnection != null && !activeConnection.isVirtual();
            if (visible) {
                DBSchema schema = mappingManager.getCurrentSchema(virtualFile);
                if (schema != null) {
                    text = NamingUtil.enhanceUnderscoresForDisplay(schema.getName());
                    icon = schema.getIcon();
View Full Code Here

    public void actionPerformed(AnActionEvent e) {
        Project project = ActionUtil.getProject(e);
        VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
        if (project != null && virtualFile != null) {
            DatabaseTransactionManager transactionManager = DatabaseTransactionManager.getInstance(project);
            ConnectionHandler activeConnection = getConnectionHandler(project, virtualFile);
            transactionManager.commit(activeConnection, true, false);
        }
    }
View Full Code Here

        e.getPresentation().setText("Commit");

        Project project = ActionUtil.getProject(e);
        VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);

        ConnectionHandler connectionHandler = virtualFile == null ? null : getConnectionHandler(project, virtualFile);
        e.getPresentation().setVisible(connectionHandler != null && !connectionHandler.isAutoCommit());
    }
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.