Package com.dci.intellij.dbn.connection

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


                    datasetEditor.getProject(),
                    "Error opening data editor for " + dataset.getQualifiedNameWithType(), e.getMessage(), false);
        }

        if (dataset.isEditable(DBContentType.DATA)) {
            ConnectionHandler connectionHandler = getConnectionHandler();
            autoCommitLabel.setConnectionHandler(connectionHandler);
        }
    }
View Full Code Here


        super();
        this.object = object;
        this.setLayout(new BorderLayout());
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        JLabel connectionLabel = new JLabel(
                connectionHandler.getName(),
                connectionHandler.getIcon(),
                SwingConstants.LEFT);
        add(connectionLabel);
        add(panel, BorderLayout.SOUTH );

        List<DBObject> chain = new ArrayList<DBObject>();
View Full Code Here

    public MethodExecutionForm(MethodExecutionInput executionInput, boolean showHeader, boolean debug) {
        this.executionInput = executionInput;
        this.debug = debug;
        DBMethod method = executionInput.getMethod();

        ConnectionHandler connectionHandler = executionInput.getConnectionHandler();
        DatabaseCompatibilityInterface compatibilityInterface = DatabaseCompatibilityInterface.getInstance(connectionHandler);
        if (compatibilityInterface.supportsFeature(DatabaseFeature.AUTHID_METHOD_EXECUTION)) {
            //ActionToolbar actionToolbar = ActionUtil.createActionToolbar("", true, new SetExecutionSchemaComboBoxAction(executionInput));
            executionSchemaActionPanel.add(new SchemaSelector(), BorderLayout.CENTER);
        } else {
            executionSchemaActionPanel.setVisible(false);
            executionSchemaLabel.setVisible(false);
        }
        connectionLabel.setText(connectionHandler.getPresentableText());
        connectionLabel.setIcon(connectionHandler.getIcon());
        autoCommitLabel.setConnectionHandler(connectionHandler);

        //objectPanel.add(new ObjectDetailsPanel(method).getComponent(), BorderLayout.NORTH);

        if (showHeader) {
            String headerTitle = method.getQualifiedName();
            Icon headerIcon = method.getIcon();
            Color headerBackground = UIUtil.getPanelBackground();
            if (getEnvironmentSettings(method.getProject()).getVisibilitySettings().getDialogHeaders().value()) {
                headerBackground = method.getEnvironmentType().getColor();
            }
            DBNHeaderForm headerForm = new DBNHeaderForm(
                    headerTitle,
                    headerIcon,
                    headerBackground);
            headerPanel.add(headerForm.getComponent(), BorderLayout.CENTER);
        }
        headerPanel.setVisible(showHeader);

        argumentsPanel.setLayout(new BoxLayout(argumentsPanel, BoxLayout.Y_AXIS));
        int[] metrics = new int[]{0, 0};

        //topSeparator.setVisible(false);
        spacer.setVisible(false);
        List<DBArgument> arguments = new ArrayList(method.getArguments());
        noArgumentsLabel.setVisible(arguments.size() == 0);
        for (DBArgument argument: arguments) {
            if (argument.isInput()) {
                spacer.setVisible(true);
                metrics = addArgumentPanel(argument, metrics);
                //topSeparator.setVisible(true);
            }
        }

        for (MethodExecutionArgumentForm component : argumentForms) {
            component.adjustMetrics(metrics);
        }

        if (argumentForms.size() > 0) {
            argumentsScrollPane.getVerticalScrollBar().setUnitIncrement(argumentForms.get(0).getScrollUnitIncrement());
        }


        Dimension preferredSize = mainPanel.getPreferredSize();
        int width = (int) preferredSize.getWidth() + 24;
        int height = (int) Math.min(preferredSize.getHeight(), 380);
        mainPanel.setPreferredSize(new Dimension(width, height));
        commitCheckBox.setSelected(executionInput.isCommitAfterExecution());
        commitCheckBox.setEnabled(!connectionHandler.isAutoCommit());
        usePoolConnectionCheckBox.setSelected(executionInput.isUsePoolConnection());

        for (MethodExecutionArgumentForm argumentComponent : argumentForms){
            argumentComponent.addDocumentListener(documentListener);
        }
View Full Code Here

    }

    @Nullable
    public DBDataset lookupDataset() {
        ConnectionManager connectionManager = ConnectionManager.getInstance(project);
        ConnectionHandler connectionHandler = connectionManager.getConnectionHandler(getConnectionId());
        if (connectionHandler != null) {
            int index = getDatasetName().lastIndexOf('.');
            String schemaName = getDatasetName().substring(0, index);
            DBSchema schema = connectionHandler.getObjectBundle().getSchema(schemaName);
            if (schema != null) {
                String datasetName = getDatasetName().substring(index + 1);
                return schema.getDataset(datasetName);
            }
        }
View Full Code Here

        }
        if (factoryInput instanceof MethodFactoryInput) {
            MethodFactoryInput methodFactoryInput = (MethodFactoryInput) factoryInput;
            DBSchema schema = methodFactoryInput.getSchema();
            try {
                ConnectionHandler connectionHandler = schema.getConnectionHandler();
                Connection connection = connectionHandler.getStandaloneConnection(schema);
                connectionHandler.getInterfaceProvider().getDDLInterface().createMethod(methodFactoryInput, connection);
                DBObjectList<DBMethod> methods = (DBObjectList<DBMethod>) schema.getChildObjects(methodFactoryInput.isFunction() ? DBObjectType.FUNCTION : DBObjectType.PROCEDURE);
                methods.reload();
                DBMethod method = methods.getObject(factoryInput.getObjectName());
                DatabaseFileSystem.getInstance().openEditor(method);
                notifyFactoryEvent(new ObjectFactoryEvent(method, ObjectFactoryEvent.EVENT_TYPE_CREATE));
View Full Code Here

        return true;
    }

    public void dropObject(final DBSchemaObject object) {
        final ConnectionHandler connectionHandler = object.getConnectionHandler();
        final DatabaseDDLInterface ddlInterface = connectionHandler.getInterfaceProvider().getDDLInterface();
        int response = Messages.showYesNoDialog(
                "Are you sure you want to drop the " + object.getQualifiedNameWithType() + "?",
                Constants.DBN_TITLE_PREFIX + "Drop object",
                Messages.getQuestionIcon());
        if (response == 0) {
            new BackgroundTask(object.getProject(), "Dropping " + object.getQualifiedNameWithType(), false) {
                public void execute(@NotNull ProgressIndicator progressIndicator) throws InterruptedException {
                    try {
                        initProgressIndicator(progressIndicator, true);
                        ddlInterface.dropObject(object.getTypeName(), object.getQualifiedName(), connectionHandler.getStandaloneConnection());

                        /*Messages.showInfoMessage(
                        NamingUtil.capitalize(object.getTypeName()) + " " + object.getQualifiedName() + " was dropped successfully.",
                        "Database Navigator - Object dropped");*/

 
View Full Code Here

    private static DBObjectTimestampLoader TIMESTAMP_LOADER = new DBObjectTimestampLoader("TRIGGER");

    @Override
    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.updateTrigger(getDataset().getSchema().getName(), getDataset().getName(), getName(), oldCode, newCode, connection);
        } finally {
            connectionHandler.freePoolConnection(connection);
        }
    }
View Full Code Here

                            FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
                            FileConnectionMappingManager connectionMappingManager = FileConnectionMappingManager.getInstance(project);
                            VirtualFile[] openFiles = fileEditorManager.getOpenFiles();
                            for (VirtualFile openFile : openFiles) {

                                ConnectionHandler activeConnection = connectionMappingManager.getActiveConnection(openFile);
                                if (activeConnection == connectionHandler) {
                                    FileEditor[] fileEditors = fileEditorManager.getEditors(openFile);
                                    for (FileEditor fileEditor : fileEditors) {
                                        Editor editor = null;
                                        if (fileEditor instanceof TextEditor) {
View Full Code Here

    }

    public String load() throws SQLException {
        Connection connection = null;
        ResultSet resultSet = null;
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        try {
            connection = connectionHandler.getPoolConnection();
            resultSet = loadSourceCode(connection);
                                                
            StringBuilder sourceCode = new StringBuilder();
            while (resultSet.next()) {
                String codeLine = resultSet.getString(1);
                sourceCode.append(codeLine);
            }

            if (sourceCode.length() == 0 && !lenient)
                throw new SQLException("Object not found in database.");

            return StringUtil.removeCharacter(sourceCode.toString(), '\r');
        } finally {
            ConnectionUtil.closeResultSet(resultSet);
            connectionHandler.freePoolConnection(connection);
        }
    }
View Full Code Here

    public Timestamp load(final DBSchemaObject object) throws SQLException{
        ProgressMonitor.setTaskDescription("Loading timestamp for " + object.getQualifiedNameWithType());
        Connection connection = null;
        ResultSet resultSet = null;
        ConnectionHandler connectionHandler = object.getConnectionHandler();
        try {
            connection = connectionHandler.getPoolConnection();
            resultSet = connectionHandler.getInterfaceProvider().getMetadataInterface().loadObjectChangeTimestamp(
                    object.getSchema().getName(),
                    object.getName(), objectType, connection);

            return resultSet.next() ? resultSet.getTimestamp(1) : null;
        finally {
            ConnectionUtil.closeResultSet(resultSet);
            connectionHandler.freePoolConnection(connection);
        }
    }
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.