Package com.dci.intellij.dbn.object

Examples of com.dci.intellij.dbn.object.DBMethod


    private void updateArgumentValueTables() {
        List<ArgumentValue> inputArgumentValues = executionResult.getExecutionInput().getArgumentValues();
        List<ArgumentValue> outputArgumentValues = executionResult.getArgumentValues();

        DBMethod method = executionResult.getMethod();
        ArgumentValuesTreeModel treeModel = new ArgumentValuesTreeModel(method, inputArgumentValues, outputArgumentValues);
        argumentValuesTree.setModel(treeModel);
        TreeUtil.expand(argumentValuesTree, 2);
    }
View Full Code Here


            if (executionInput.getMethodRef().equals(methodRef)) {
                return executionInput;
            }
        }

        DBMethod method = methodRef.get();
        if (method != null) {
            MethodExecutionInput executionInput = new MethodExecutionInput(method);
            executionInputs.add(executionInput);
            return executionInput;
        }
View Full Code Here

        return promptExecutionDialog(executionInput, debug);
    }

    public boolean promptExecutionDialog(MethodExecutionInput executionInput, boolean debug) {
        if (executionInput.getConnectionHandler().isValid(true)) {
            DBMethod method = executionInput.getMethod();
            if (method == null) {
                String message =
                        "Can not execute method " +
                         executionInput.getMethodRef().getPath() + ".\nMethod not found!";
                MessageUtil.showErrorDialog(message);
View Full Code Here

        execute(executionInput);
    }

    public void execute(final MethodExecutionInput executionInput) {
        executionInput.setExecuting(true);
        final DBMethod method = executionInput.getMethod();
        if (method == null) {
            DBMethodRef methodRef = executionInput.getMethodRef();
            MessageUtil.showErrorDialog("Could not resolve " + methodRef.getMethodObjectType().getName() + " \"" + methodRef.getSchemaName() + "." + methodRef.getQualifiedMethodName() + "\".");
        } else {
            final Project project = method.getProject();
            DatabaseExecutionInterface executionInterface = method.getConnectionHandler().getInterfaceProvider().getDatabaseExecutionInterface();
            final MethodExecutionProcessor executionProcessor = executionInterface.createExecutionProcessor(method);

            new BackgroundTask(project, "Executing method", false) {
                public void execute(@NotNull ProgressIndicator progressIndicator) {
                    try {
                        initProgressIndicator(progressIndicator, true, "Executing " + method.getQualifiedNameWithType());
                        executionInput.initExecutionResult(false);
                        executionProcessor.execute(executionInput);
                        if (!executionInput.isExecutionCancelled()) {
                            new SimpleLaterInvocator() {
                                public void execute() {
                                    ExecutionManager executionManager = ExecutionManager.getInstance(project);
                                    executionManager.showExecutionConsole(executionInput.getExecutionResult());
                                    executionInput.setExecuting(false);
                                }
                            }.start();
                        }

                        executionInput.setExecutionCancelled(false);
                    } catch (final SQLException e) {
                        executionInput.setExecuting(false);
                        if (!executionInput.isExecutionCancelled()) {
                            new SimpleLaterInvocator() {
                                public void execute() {
                                    MessageUtil.showErrorDialog("Could not execute " + method.getTypeName() + ".", e);
                                    if (promptExecutionDialog(executionInput, false)) {
                                        MethodExecutionManager.this.execute(executionInput);
                                    }
                                }
                            }.start();
View Full Code Here

            }.start();
        }
    }

    public boolean debugExecute(final MethodExecutionInput executionInput, final Connection connection) {
        final DBMethod method = executionInput.getMethod();
        DatabaseExecutionInterface executionInterface = method.getConnectionHandler().getInterfaceProvider().getDatabaseExecutionInterface();
        final MethodExecutionProcessor executionProcessor = executionInterface.createDebugExecutionProcessor(method);
        try {
            executionInput.initExecutionResult(true);
            executionProcessor.execute(executionInput, connection);
            if (!executionInput.isExecutionCancelled()) {
                new SimpleLaterInvocator() {
                    public void execute() {
                        ExecutionManager executionManager = ExecutionManager.getInstance(method.getProject());
                        executionManager.showExecutionConsole(executionInput.getExecutionResult());
                    }
                }.start();
            }
            executionInput.setExecutionCancelled(false);
            return true;
        } catch (final SQLException e) {
            if (!executionInput.isExecutionCancelled()) {
                new SimpleLaterInvocator() {
                    public void execute() {
                        MessageUtil.showErrorDialog("Could not execute " + method.getTypeName() + ".", e);
                    }
                }.start();
            }
            return false;
        }
View Full Code Here

    private boolean debug;

    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);
View Full Code Here

        @Override
        public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            ArgumentValuesTreeNode treeNode = (ArgumentValuesTreeNode) value;
            Object userValue = treeNode.getUserValue();
            if (userValue instanceof DBMethod) {
                DBMethod method = (DBMethod) userValue;
                setIcon(method.getIcon());
                append(method.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
            }

            if (userValue instanceof String) {
                append((String) userValue, treeNode.isLeaf() ?
                        SimpleTextAttributes.REGULAR_ATTRIBUTES :
View Full Code Here

        }
        return null;
    }

    public DBMethod getMethod(String name, int overload) {
        DBMethod method = getProcedure(name, overload);
        if (method == null) method = getFunction(name, overload);
        return method;
    }
View Full Code Here

        return program;
    }

    public DBMethod getMethod(String name, String type, int overload) {
        if (type == null) {
            DBMethod method = getProcedure(name, overload);
            if (method == null) method = getFunction(name, overload);
            return method;
        } else if (type.equalsIgnoreCase("PROCEDURE")) {
            return getProcedure(name, overload);
        } else if (type.equalsIgnoreCase("FUNCTION")) {
View Full Code Here

                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));
            } catch (SQLException e) {
                MessageUtil.showErrorDialog("Could not create " + factoryInput.getObjectType().getName() + ".", e);
                return false;
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.object.DBMethod

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.