Search in sources :

Example 11 with Presentation

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

the class PyStudyIntroductionCourseAction method update.

@Override
public void update(AnActionEvent e) {
    final File projectDir = new File(ProjectUtil.getBaseDir(), INTRODUCTION_FOLDER);
    if (projectDir.exists()) {
        return;
    }
    if (StudyProjectGenerator.getBundledIntro() != null) {
        return;
    }
    Presentation presentation = e.getPresentation();
    presentation.setVisible(false);
    presentation.setEnabled(false);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation) File(java.io.File)

Example 12 with Presentation

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

the class OpenTaskInBrowserAction method update.

@Override
public void update(AnActionEvent event) {
    super.update(event);
    if (event.getPresentation().isEnabled()) {
        Presentation presentation = event.getPresentation();
        String url = getIssueUrl(event);
        presentation.setEnabled(url != null);
        Project project = getProject(event);
        if (project == null || !TaskManager.getManager(project).getActiveTask().isIssue()) {
            presentation.setText(getTemplatePresentation().getText());
        } else {
            presentation.setText("Open '" + TaskManager.getManager(project).getActiveTask().getPresentableName() + "' In _Browser");
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 13 with Presentation

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

the class CloseTaskAction method update.

@Override
public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = getProject(event);
    boolean enabled = project != null && !TaskManager.getManager(project).getActiveTask().isDefault();
    presentation.setEnabled(enabled);
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 14 with Presentation

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

the class EditTaskAction method update.

@Override
public void update(AnActionEvent event) {
    super.update(event);
    Presentation presentation = event.getPresentation();
    Project project = getEventProject(event);
    if (project != null && presentation.isEnabled()) {
        presentation.setText("Edit '" + TaskManager.getManager(project).getActiveTask().getPresentableName() + "'");
    }
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 15 with Presentation

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

the class ExpandSelectionAction method update.

public void update(final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext());
    if (editor == null) {
        presentation.setEnabled(false);
        return;
    }
    final SelectionState selectionState = editor.getSelectionState();
    selectionState.setInsideChange(true);
    final Stack<ComponentPtr[]> history = selectionState.getSelectionHistory();
    presentation.setEnabled(!history.isEmpty());
}
Also used : GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor) Presentation(com.intellij.openapi.actionSystem.Presentation) SelectionState(com.intellij.uiDesigner.SelectionState)

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