Search in sources :

Example 6 with Presentation

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

the class MavenAction method update.

@Override
public void update(AnActionEvent e) {
    super.update(e);
    Presentation p = e.getPresentation();
    p.setEnabled(isAvailable(e));
    p.setVisible(isVisible(e));
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 7 with Presentation

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

the class SvnTestCase method imitUpdate.

protected static void imitUpdate(final Project project) {
    ProjectLevelVcsManagerEx.getInstanceEx(project).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
    final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
    action.getTemplatePresentation().setText("1");
    action.actionPerformed(new AnActionEvent(null, dataId -> {
        if (CommonDataKeys.PROJECT.is(dataId)) {
            return project;
        }
        return null;
    }, "test", new Presentation(), ActionManager.getInstance(), 0));
    final ChangeListManager clManager = ChangeListManager.getInstance(project);
    clManager.ensureUpToDate(false);
    // wait for after-events like annotations recalculation
    clManager.ensureUpToDate(false);
    // zipper updater
    sleep(100);
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) PluginPathManager(com.intellij.openapi.application.PluginPathManager) VirtualFile(com.intellij.openapi.vfs.VirtualFile) com.intellij.openapi.vcs.changes(com.intellij.openapi.vcs.changes) Presentation(com.intellij.openapi.actionSystem.Presentation) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) StartupManagerImpl(com.intellij.ide.startup.impl.StartupManagerImpl) MockChangelistBuilder(com.intellij.testFramework.vcs.MockChangelistBuilder) Semaphore(com.intellij.util.concurrency.Semaphore) After(org.junit.After) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) Messages(com.intellij.openapi.ui.Messages) SvnVcs(org.jetbrains.idea.svn.SvnVcs) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) FileUtil(com.intellij.openapi.util.io.FileUtil) VcsException(com.intellij.openapi.vcs.VcsException) SvnConfiguration(org.jetbrains.idea.svn.SvnConfiguration) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) SvnFileUrlMappingImpl(org.jetbrains.idea.svn.SvnFileUrlMappingImpl) MockChangeListManagerGate(com.intellij.testFramework.vcs.MockChangeListManagerGate) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) Nullable(org.jetbrains.annotations.Nullable) TimeoutUtil(com.intellij.util.TimeoutUtil) Processor(com.intellij.util.Processor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ApplicationManager(com.intellij.openapi.application.ApplicationManager) VcsShowConfirmationOption(com.intellij.openapi.vcs.VcsShowConfirmationOption) NotNull(org.jetbrains.annotations.NotNull) java.util(java.util) TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) PathManager(com.intellij.openapi.application.PathManager) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) StartupManager(com.intellij.openapi.startup.StartupManager) Project(com.intellij.openapi.project.Project) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) Before(org.junit.Before) StringUtil(com.intellij.openapi.util.text.StringUtil) TestClientRunner(com.intellij.testFramework.vcs.TestClientRunner) IOException(java.io.IOException) TestDialog(com.intellij.openapi.ui.TestDialog) CreateExternalAction(org.jetbrains.idea.svn.actions.CreateExternalAction) VFileContentChangeEvent(com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent) SystemInfo(com.intellij.openapi.util.SystemInfo) File(java.io.File) AbstractJunitVcsTestCase(com.intellij.testFramework.vcs.AbstractJunitVcsTestCase) UndoManager(com.intellij.openapi.command.undo.UndoManager) BulkFileListener(com.intellij.openapi.vfs.newvfs.BulkFileListener) ProcessOutput(com.intellij.execution.process.ProcessOutput) SvnApplicationSettings(org.jetbrains.idea.svn.SvnApplicationSettings) Assert(org.junit.Assert) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) ZipUtil(com.intellij.util.io.ZipUtil) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 8 with Presentation

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

the class SvnAnnotationIsClosedTest method testClosedChangedByUpdateInIdea.

@Test
public void testClosedChangedByUpdateInIdea() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    //#1
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
    //#2
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
    //#3
    checkin();
    // take #2
    runInAndVerifyIgnoreOutput("up", "-r", "2");
    final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
    final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
    annotation.setCloser(() -> {
        myIsClosed = true;
        listener.unregisterAnnotation(tree.myS1File, annotation);
    });
    listener.registerAnnotation(tree.myS1File, annotation);
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertFalse(myIsClosed);
    ProjectLevelVcsManagerEx.getInstanceEx(myProject).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
    final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
    action.getTemplatePresentation().setText("1");
    action.actionPerformed(new AnActionEvent(null, dataId -> {
        if (CommonDataKeys.PROJECT.is(dataId)) {
            return myProject;
        }
        return null;
    }, "test", new Presentation(), ActionManager.getInstance(), 0));
    myChangeListManager.ensureUpToDate(false);
    // wait for after-events like annotations recalculation
    myChangeListManager.ensureUpToDate(false);
    // zipper updater
    sleep(100);
    Assert.assertTrue(myIsClosed);
}
Also used : VcsTestUtil(com.intellij.openapi.vcs.VcsTestUtil) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) Change(com.intellij.openapi.vcs.changes.Change) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) VcsRevisionDescription(com.intellij.openapi.vcs.history.VcsRevisionDescription) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) List(java.util.List) Assert(junit.framework.Assert) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) VcsDirtyScopeManager(com.intellij.openapi.vcs.changes.VcsDirtyScopeManager) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) VcsException(com.intellij.openapi.vcs.VcsException) Collections(java.util.Collections) Before(org.junit.Before) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test)

Example 9 with Presentation

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

the class RestPythonUtil method updateSphinxQuickStartRequiredAction.

public static Presentation updateSphinxQuickStartRequiredAction(final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
        Module module = e.getData(LangDataKeys.MODULE);
        if (module == null) {
            Module[] modules = ModuleManager.getInstance(project).getModules();
            module = modules.length == 0 ? null : modules[0];
        }
        if (module != null) {
            final Sdk sdk = PythonSdkType.findPythonSdk(module);
            if (sdk != null) {
                final List<PyPackage> packages = PyPackageManager.getInstance(sdk).getPackages();
                final PyPackage sphinx = packages != null ? PyPackageUtil.findPackage(packages, "Sphinx") : null;
                presentation.setEnabled(sphinx != null);
            }
        }
    }
    return presentation;
}
Also used : Project(com.intellij.openapi.project.Project) PyPackage(com.jetbrains.python.packaging.PyPackage) Sdk(com.intellij.openapi.projectRoots.Sdk) Presentation(com.intellij.openapi.actionSystem.Presentation) Module(com.intellij.openapi.module.Module)

Example 10 with Presentation

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

the class ShowHideMergePanelAction method update.

@Override
public void update(final AnActionEvent e) {
    super.update(e);
    final Presentation presentation = e.getPresentation();
    presentation.setIcon(SvnIcons.ShowIntegratedFrom);
    presentation.setText(SvnBundle.message("committed.changes.action.enable.merge.highlighting"));
    presentation.setDescription(SvnBundle.message("committed.changes.action.enable.merge.highlighting.description.text"));
}
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