Search in sources :

Example 41 with Presentation

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

the class NextSplitAction method update.

public void update(final AnActionEvent event) {
    final Project project = event.getProject();
    final Presentation presentation = event.getPresentation();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    presentation.setEnabled(toolWindowManager.isEditorComponentActive() && manager.isInSplitter() && manager.getCurrentWindow() != null);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Presentation(com.intellij.openapi.actionSystem.Presentation) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 42 with Presentation

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

the class NonEmptyActionGroup method update.

public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    presentation.setVisible(getChildrenCount() > 0);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 43 with Presentation

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

the class RevealFileAction method update.

@Override
public void update(AnActionEvent e) {
    VirtualFile file = ShowFilePathAction.findLocalFile(CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext()));
    Presentation presentation = e.getPresentation();
    presentation.setText(getActionName());
    presentation.setEnabled(file != null);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 44 with Presentation

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

the class BaseToolWindowToggleAction method update.

@Override
public final void update(AnActionEvent e) {
    super.update(e);
    Presentation presentation = e.getPresentation();
    Project project = e.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManager mgr = ToolWindowManager.getInstance(project);
    String id = mgr.getActiveToolWindowId();
    if (id == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindow window = mgr.getToolWindow(id);
    if (window == null) {
        presentation.setEnabled(false);
        return;
    }
    update(window, presentation);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 45 with Presentation

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

the class HideAllToolWindowsAction method update.

public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = event.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    String[] ids = toolWindowManager.getToolWindowIds();
    for (String id : ids) {
        if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
            presentation.setEnabled(true);
            presentation.setText(IdeBundle.message("action.hide.all.windows"), true);
            return;
        }
    }
    final DesktopLayout layout = toolWindowManager.getLayoutToRestoreLater();
    if (layout != null) {
        presentation.setEnabled(true);
        presentation.setText(IdeBundle.message("action.restore.windows"));
        return;
    }
    presentation.setEnabled(false);
}
Also used : Project(com.intellij.openapi.project.Project) DesktopLayout(com.intellij.openapi.wm.impl.DesktopLayout) Presentation(com.intellij.openapi.actionSystem.Presentation) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

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