Package com.intellij.openapi.actionSystem

Examples of com.intellij.openapi.actionSystem.Presentation


        super(text, description, icon);
    }

    public void update(AnActionEvent actionEvent) {
        super.update(actionEvent);
        final Presentation presentation = actionEvent.getPresentation();
        presentation.setEnabled(enabled);
    }
View Full Code Here


    private JSFileFilter jsFileFilter = new JSFileFilter();

    public void update(AnActionEvent actionEvent) {
        super.update(actionEvent);
        final Presentation presentation = actionEvent.getPresentation();
        presentation.setEnabled(isEnabled(actionEvent));
    }
View Full Code Here

        CompileType compileType = getCompilerSettings(object.getProject()).getCompileType();
        compilerManager.compileObject(object, contentType, compileType, false);
    }

    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();

        CompilerSettings compilerSettings = getCompilerSettings(object.getProject());
        CompileType compileType = compilerSettings.getCompileType();
        DBObjectStatusHolder status = object.getStatus();

        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 isDebug = status.is(contentType, DBObjectStatus.DEBUG);
        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.setText(text);
    }
View Full Code Here

            configuration.setExecutionInput(executionInput);
        }

        @Override
        public void update(AnActionEvent e) {
            Presentation presentation = e.getPresentation();
            DBMethod method = executionInput.getMethod();
            if (method == null) {
                presentation.setIcon(Icons.DBO_METHOD);
            } else {
                presentation.setIcon(method.getOriginalIcon());
            }
            presentation.setText(NamingUtil.enhanceNameForDisplay(executionInput.getMethodRef().getPath()));
        }
View Full Code Here

        }
    }

    @Override
    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        Object selection = getSelection();
        if (selection instanceof CompoundFilterCondition) {
            CompoundFilterCondition condition = (CompoundFilterCondition) selection;
            presentation.setEnabled(condition.getConditions().size() > 1);
        } else {
            presentation.setEnabled(false);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        Object selection = getSelection();
        if (selection instanceof CompoundFilterCondition) {
            presentation.setText("Add Condition");
            presentation.setEnabled(true);
            presentation.setIcon(Icons.ACTION_ADD);
        } else if (selection instanceof SimpleFilterCondition) {
            presentation.setText("Join Condition");
            presentation.setEnabled(true);
            presentation.setIcon(Icons.ACTION_ADD_SPECIAL);
        } else {
            presentation.setIcon(Icons.ACTION_ADD);
            presentation.setEnabled(false);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        Object selection = getSelection();
        if (selection instanceof ObjectNameFilter) {
            presentation.setText("Remove Filter");
            presentation.setEnabled(true);
        } else if (selection instanceof FilterCondition) {
            presentation.setText("Remove Condition");
            presentation.setEnabled(true);
        } else {
            presentation.setEnabled(false);
        }
    }
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 > 0);
            } else {
                CompoundFilterCondition parentCondition = condition.getParent();
                List<FilterCondition> conditions = parentCondition.getConditions();
                int index = conditions.indexOf(condition);
                presentation.setEnabled(index > 0);
            }

        } else {
            presentation.setEnabled(false);
        }
    }
View Full Code Here

            FileConnectionMappingManager.getInstance(project).selectActiveConnectionForEditor(editor, connectionHandler);
        }
    }

    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        boolean enabled = true;
        Project project = ActionUtil.getProject(e);
        VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
        if (virtualFile instanceof DatabaseEditableObjectFile) {
            enabled = false;
        } else {
            if (virtualFile != null && virtualFile.getFileType() instanceof DBLanguageFileType) {
                if (connectionHandler == null) {
                    enabled = true;
                } else {
                    ConnectionBundle connectionBundle = connectionHandler.getConnectionBundle();
                    if (connectionBundle instanceof ModuleConnectionBundle) {
                        Module currentModule = ModuleUtil.findModuleForFile(virtualFile, project);
                        Module connectionModule = ((ModuleConnectionBundle) connectionBundle).getModule();
                        enabled = connectionModule == currentModule;
                    }
                }
            } else {
                enabled = false;
            }
        }
        presentation.setEnabled(enabled);

    }
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

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.