Search in sources :

Example 91 with Presentation

use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.

the class MultiCaretCodeInsightAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    Project project = e.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    Editor hostEditor = CommonDataKeys.EDITOR.getData(e.getDataContext());
    if (hostEditor == null) {
        presentation.setEnabled(false);
        return;
    }
    final Ref<Boolean> enabled = new Ref<>(Boolean.FALSE);
    iterateOverCarets(project, hostEditor, new MultiCaretCodeInsightActionHandler() {

        @Override
        public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
            if (isValidFor(project, editor, caret, file)) {
                enabled.set(Boolean.TRUE);
            }
        }
    });
    presentation.setEnabled(enabled.get());
}
Also used : Project(com.intellij.openapi.project.Project) Ref(com.intellij.openapi.util.Ref) PsiFile(com.intellij.psi.PsiFile) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 92 with Presentation

use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.

the class ChooseRunConfigurationPopupAction method update.

@Override
public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final Project project = e.getData(CommonDataKeys.PROJECT);
    presentation.setEnabled(true);
    if (project == null || project.isDisposed()) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
        return;
    }
    if (null == getDefaultExecutor()) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
        return;
    }
    presentation.setEnabled(true);
    presentation.setVisible(true);
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 93 with Presentation

use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.

the class EditRunConfigurationsAction method update.

@Override
public void update(final AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    Project project = e.getProject();
    presentation.setEnabled(project == null || !DumbService.isDumb(project));
    if (ActionPlaces.RUN_CONFIGURATIONS_COMBOBOX.equals(e.getPlace())) {
        presentation.setText(ExecutionBundle.message("edit.configuration.action"));
        presentation.setDescription(presentation.getText());
    }
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 94 with Presentation

use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.

the class BrowseCallHierarchyAction method update.

@Override
public final void update(final AnActionEvent event) {
    final Presentation presentation = event.getPresentation();
    if (!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
        presentation.setText(IdeBundle.message("action.browse.call.hierarchy"));
    }
    super.update(event);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 95 with Presentation

use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.

the class BrowseTypeHierarchyAction method update.

@Override
public final void update(final AnActionEvent event) {
    final Presentation presentation = event.getPresentation();
    if (!ActionPlaces.isMainMenuOrActionSearch(event.getPlace())) {
        presentation.setText(IdeBundle.message("action.browse.type.hierarchy"));
    }
    super.update(event);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation)

Aggregations

Presentation (com.intellij.openapi.actionSystem.Presentation)236 Project (com.intellij.openapi.project.Project)76 VirtualFile (com.intellij.openapi.vfs.VirtualFile)34 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)11 DataContext (com.intellij.openapi.actionSystem.DataContext)10 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)8 AnAction (com.intellij.openapi.actionSystem.AnAction)7 PsiFile (com.intellij.psi.PsiFile)6 IdeView (com.intellij.ide.IdeView)5 ActionManager (com.intellij.openapi.actionSystem.ActionManager)5 Editor (com.intellij.openapi.editor.Editor)5 File (java.io.File)5 Module (com.intellij.openapi.module.Module)4 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)4 PsiDirectory (com.intellij.psi.PsiDirectory)4 Course (com.jetbrains.edu.learning.courseFormat.Course)4 StudyEditor (com.jetbrains.edu.learning.editor.StudyEditor)4 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)3 NotNull (org.jetbrains.annotations.NotNull)3 Before (org.junit.Before)3