Search in sources :

Example 96 with Presentation

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

the class DumpLookupElementWeights method update.

@Override
public void update(final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final Editor editor = e.getData(CommonDataKeys.EDITOR);
    presentation.setEnabled(editor != null && LookupManager.getActiveLookup(editor) != null);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation) Editor(com.intellij.openapi.editor.Editor)

Example 97 with Presentation

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

the class ContentEntryEditingAction method update.

@Override
public void update(AnActionEvent e) {
    super.update(e);
    final Presentation presentation = e.getPresentation();
    presentation.setEnabled(true);
    final VirtualFile[] files = getSelectedFiles();
    if (files.length == 0) {
        presentation.setEnabled(false);
        return;
    }
    for (VirtualFile file : files) {
        if (file == null || !file.isDirectory()) {
            presentation.setEnabled(false);
            break;
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 98 with Presentation

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

the class LocalHistoryAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Presentation p = e.getPresentation();
    if (e.getProject() == null) {
        p.setEnabledAndVisible(false);
    } else {
        p.setVisible(true);
        p.setText(getText(e), true);
        LocalHistoryFacade vcs = getVcs();
        IdeaGateway gateway = getGateway();
        p.setEnabled(vcs != null && gateway != null && isEnabled(vcs, gateway, e));
    }
}
Also used : IdeaGateway(com.intellij.history.integration.IdeaGateway) LocalHistoryFacade(com.intellij.history.core.LocalHistoryFacade) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 99 with Presentation

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

the class TreeExpandAllActionBase method update.

public final void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    TreeExpander expander = getExpander(event.getDataContext());
    presentation.setEnabled(expander != null && expander.canExpand());
}
Also used : TreeExpander(com.intellij.ide.TreeExpander) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 100 with Presentation

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

the class FakeRerunAction method update.

@Override
public void update(@NotNull AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    ExecutionEnvironment environment = getEnvironment(event);
    if (environment != null) {
        presentation.setText(ExecutionBundle.message("rerun.configuration.action.name", StringUtil.escapeMnemonics(environment.getRunProfile().getName())));
        presentation.setIcon(ExecutionManagerImpl.isProcessRunning(getDescriptor(event)) ? AllIcons.Actions.Restart : environment.getExecutor().getIcon());
        presentation.setEnabled(isEnabled(event));
        return;
    }
    presentation.setEnabled(false);
}
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