Package com.dci.intellij.dbn.connection

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


    public DBLanguageFileEditorToolbarForm(Project project, VirtualFile file, JComponent editorComponent) {
        ActionToolbar actionToolbar = ActionUtil.createActionToolbar("", true, "DBNavigator.ActionGroup.FileEditor");
        actionToolbar.setTargetComponent(editorComponent);
        actionsPanel.add(actionToolbar.getComponent(), BorderLayout.CENTER);

        ConnectionHandler connectionHandler = FileConnectionMappingManager.getInstance(project).getActiveConnection(file);
        autoCommitLabel.setConnectionHandler(connectionHandler);
    }
View Full Code Here


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

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

        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

        Project project = ActionUtil.getProject(e);
        VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
        boolean enabled = false;
        if (project != null && virtualFile != null) {
            FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(project);
            ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(virtualFile);
            enabled = activeConnection != null && activeConnection.hasUncommittedChanges();
        }
        e.getPresentation().setEnabled(enabled);
    }
View Full Code Here

    public void execute(MethodExecutionInput executionInput) throws SQLException {
        boolean usePoolConnection = executionInput.isUsePoolConnection();
        T method = getMethod();
        if (method != null) {
            ConnectionHandler connectionHandler = method.getConnectionHandler();
            DBSchema executionSchema = executionInput.getExecutionSchema();
            Connection connection = usePoolConnection ?
                    connectionHandler.getPoolConnection(executionSchema) :
                    connectionHandler.getStandaloneConnection(executionSchema);
            if (usePoolConnection) {
                connection.setAutoCommit(false);
            }
            execute(executionInput, connection);
        }
View Full Code Here

    private DBObject object;

    public ObjectDetailsForm(DBObject object) {
        this.object = object;
        objectPanel.setLayout(new BoxLayout(objectPanel, BoxLayout.X_AXIS));
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        connectionLabel.setText(connectionHandler.getName());
        connectionLabel.setIcon(connectionHandler.getIcon());
       

        java.util.List<DBObject> chain = new ArrayList<DBObject>();
        while (object != null) {
            chain.add(0, object);
View Full Code Here

            execute(executionInput, connection);
        }
    }

    public void execute(MethodExecutionInput executionInput, Connection connection) throws SQLException {
        ConnectionHandler connectionHandler = null;
        boolean usePoolConnection = false;
        try {
            long startTime = System.currentTimeMillis();

            String command = buildExecutionCommand(executionInput);
            T method = getMethod();
            if (method != null) {
                connectionHandler = method.getConnectionHandler();
                usePoolConnection = executionInput.isUsePoolConnection();
                CallableStatement callableStatement = connection.prepareCall (command);

                prepareCall(executionInput, callableStatement);
                callableStatement.execute();
                callableStatement.setQueryTimeout(10);
                if (!usePoolConnection) connectionHandler.notifyChanges(method.getVirtualFile());

                MethodExecutionResult executionResult = executionInput.getExecutionResult();
                if (executionResult != null) {
                    loadValues(executionResult, callableStatement);
                    executionResult.setExecutionDuration((int) (System.currentTimeMillis() - startTime));
                }
            }

        } finally {
            if (executionInput.isCommitAfterExecution()) {
                if (usePoolConnection) {
                    connection.commit();
                } else {
                    if (connectionHandler != null) connectionHandler.commit();
                }
            }
            if (connectionHandler != null && usePoolConnection) connectionHandler.freePoolConnection(connection);
        }

    }
View Full Code Here

    @Override
    public void registerBreakpoint(@NotNull XLineBreakpoint<DBProgramBreakpointProperties> breakpoint) {
        if (!debugProcess.getStatus().CAN_SET_BREAKPOINTS) return;

        ConnectionHandler connectionHandler = debugProcess.getConnectionHandler();
        DatabaseEditableObjectFile databaseFile = getDatabaseFile(breakpoint);
        if (databaseFile == null) {
            XDebuggerManager.getInstance(session.getProject()).getBreakpointManager().removeBreakpoint(breakpoint);
        } else {
            DBSchemaObject object = databaseFile.getObject();
            if (object.getConnectionHandler() == connectionHandler) {
                DatabaseDebuggerInterface debuggerInterface = connectionHandler.getInterfaceProvider().getDebuggerInterface();

                Connection debugConnection = debugProcess.getDebugConnection();
                try {
                    Integer breakpointId = breakpoint.getUserData(BREAKPOINT_ID_KEY);
View Full Code Here

        SourceCodeLoader loader = new SourceCodeLoader(this);
        return loader.load();
    }

    public void executeUpdateDDL(DBContentType contentType, String oldCode, String newCode) throws SQLException {
        ConnectionHandler connectionHandler = getConnectionHandler();
        Connection connection = connectionHandler.getPoolConnection(getSchema());
        try {
            DatabaseDDLInterface ddlInterface = connectionHandler.getInterfaceProvider().getDDLInterface();
            ddlInterface.updateView(getName(), oldCode, newCode, connection);
        } finally {
            connectionHandler.freePoolConnection(connection);
        }
    }
View Full Code Here

    }

    public abstract boolean hasReturnArgument();

    private void createUIComponents() {
        ConnectionHandler connectionHandler = getConnectionHandler();
        DatabaseCompatibilityInterface compatibilityInterface = connectionHandler.getInterfaceProvider().getCompatibilityInterface();
        boolean enforceInArguments = hasReturnArgument() && !compatibilityInterface.supportsFeature(DatabaseFeature.FUNCTION_OUT_ARGUMENTS);
        argumentListPanel = new ArgumentFactoryInputListPanel(connectionHandler, enforceInArguments);
        argumentListComponent = argumentListPanel.getComponent();
        returnArgumentDataTypeEditor = new DataTypeEditor(getConnectionHandler());
    }
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.