Package com.intellij.openapi.actionSystem

Examples of com.intellij.openapi.actionSystem.Presentation


        } else {
            PsiFile currentFile = PsiUtil.getPsiFile(project, virtualFile);
            enabled = currentFile instanceof DBLanguageFile;
        }

        Presentation presentation = e.getPresentation();
        presentation.setEnabled(enabled);
        presentation.setText(NamingUtil.enhanceUnderscoresForDisplay(schema.getName()));
        presentation.setIcon(schema.getIcon());
        presentation.setDescription(schema.getDescription());

    }
View Full Code Here


    }

    @Override
    public void update(AnActionEvent e) {
        Object selection = getSelection();
        Presentation presentation = e.getPresentation();
        if (selection instanceof FilterCondition) {
            FilterCondition condition = (FilterCondition) selection;
            if (condition instanceof ObjectNameFilter) {
                ObjectNameFilter filter = (ObjectNameFilter) condition;
                List<ObjectNameFilter> filters = filter.getSettings().getFilters();
                int index = filters.indexOf(filter);
                presentation.setEnabled(index < filters.size() - 1);
            } else {
                CompoundFilterCondition parentCondition = condition.getParent();
                List<FilterCondition> conditions = parentCondition.getConditions();
                int index = conditions.indexOf(condition);
                presentation.setEnabled(index < conditions.size() - 1);
            }
        } else {
            presentation.setEnabled(false);
        }
    }
View Full Code Here

            globalSettingsDialog.show();
        }
    }

    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        presentation.setIcon(Icons.ACTION_SETTINGS);
        presentation.setText("Settings");
    }
View Full Code Here

        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile sourcecodeFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        presentation.setIcon(Icons.CODE_EDITOR_DDL_FILE);
        presentation.setText("DDL Files");
        presentation.setEnabled(sourcecodeFile != null);
    }
View Full Code Here

        boolean enabled = executionResult != null &&
                executionResult.hasResult() &&
                !executionResult.getResultTable().isLoading() &&
                !executionResult.getTableModel().isResultSetExhausted();

        Presentation presentation = e.getPresentation();
        presentation.setEnabled(enabled);
        presentation.setText("Fetch next records");
    }
View Full Code Here

        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        presentation.setEnabled(virtualFile!= null && virtualFile.isModified());
        presentation.setText("Rollback changes");
    }
View Full Code Here

    }

    @Override
    public void update(AnActionEvent e) {
        StatementExecutionCursorResult executionResult = getExecutionResult(e);
        Presentation presentation = e.getPresentation();
        presentation.setEnabled(
                executionResult != null &&
                !executionResult.getResultTable().isLoading());
       
        presentation.setText("Rerun statement");
    }
View Full Code Here

        }
    }

    public void update(AnActionEvent e) {
        SourceCodeFile virtualFile = getSourcecodeFile(e);
        Presentation presentation = e.getPresentation();
        if (virtualFile == null) {
            presentation.setEnabled(false);
        } else {

            DBSchemaObject schemaObject = virtualFile.getObject();
            if (schemaObject != null) {
                DatabaseCompatibilityInterface compatibilityInterface = DatabaseCompatibilityInterface.getInstance(schemaObject);
                if (schemaObject.getProperties().is(DBObjectProperty.COMPILABLE) &&  compatibilityInterface.supportsFeature(DatabaseFeature.OBJECT_INVALIDATION)) {
                    CompilerSettings compilerSettings = getCompilerSettings(schemaObject.getProject());
                    CompileType compileType = compilerSettings.getCompileType();
                    DBObjectStatusHolder status = schemaObject.getStatus();
                    DBContentType contentType = virtualFile.getContentType();

                    boolean isDebug = compileType == CompileType.DEBUG;
                    if (compileType == CompileType.KEEP) {
                        isDebug = status.is(contentType, DBObjectStatus.DEBUG);
                    }

                    boolean isPresent = status.is(contentType, DBObjectStatus.PRESENT);
                    boolean isValid = status.is(contentType, DBObjectStatus.VALID);

                    boolean isCompiling = status.is(contentType, DBObjectStatus.COMPILING);
                    boolean isEnabled = isPresent && !isCompiling && (compilerSettings.alwaysShowCompilerControls() || !isValid /*|| isDebug != isDebugActive*/);

                    presentation.setEnabled(isEnabled);
                    String text =
                            contentType == DBContentType.CODE_SPEC ? "Compile spec" :
                                    contentType == DBContentType.CODE_BODY ? "Compile body" : "Compile";

                    if (isDebug) text = text + " (Debug)";
                    if (compileType == CompileType.ASK) text = text + "...";

                    presentation.setVisible(true);
                    presentation.setText(text);

                    Icon icon = isDebug ?
                            CompileType.DEBUG.getIcon() :
                            CompileType.NORMAL.getIcon();
                    presentation.setIcon(icon);
                } else {
                    presentation.setVisible(false);
                }
            } else {
                presentation.setVisible(false);
            }
        }
    }
View Full Code Here

        FileEditorManager fileEditorManager = FileEditorManager.getInstance(connectionHandler.getProject());
        fileEditorManager.openFile(connectionHandler.getSQLConsoleFile(), true);
    }

    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        Project project = ActionUtil.getProject(e);
        presentation.setEnabled(project != null);
        presentation.setIcon(Icons.FILE_SQL_CONSOLE);
    }
View Full Code Here

            datasetEditor.insertRecord();
        }
    }

    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        presentation.setText("Insert record");
        DatasetEditor datasetEditor = getDatasetEditor(e);

        if (datasetEditor == null) {
            presentation.setEnabled(false);
        } else {
            presentation.setVisible(!datasetEditor.isReadonlyData());
            presentation.setEnabled(
                    datasetEditor.getActiveConnection().isConnected() &&
                    !datasetEditor.isReadonly() &&
                    !datasetEditor.isInserting() &&
                    !datasetEditor.isLoading());
View Full Code Here

TOP

Related Classes of com.intellij.openapi.actionSystem.Presentation

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.