From 903b72063145f8b023fe9582df7af1291ef5b663 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 13 May 2025 12:38:34 +0200 Subject: [PATCH] IDEA-355836 Create new Java class / new Kotlin class actions should not be available on the top project level make test compatible with 251 (cherry picked from commit 1e50ff79540f85b98d59aeebbb7999dfd40d6ac1) IJ-CR-162668 GitOrigin-RevId: d34e833215932a02f2b8b5538d6263bcd86df38e --- .../java/ide/actions/CreateClassActionAvailabilityTest.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/java/ide/actions/CreateClassActionAvailabilityTest.kt b/java/java-tests/testSrc/com/intellij/java/ide/actions/CreateClassActionAvailabilityTest.kt index 4e4bf71e11b7..09d6b986d7b7 100644 --- a/java/java-tests/testSrc/com/intellij/java/ide/actions/CreateClassActionAvailabilityTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/ide/actions/CreateClassActionAvailabilityTest.kt @@ -6,7 +6,6 @@ import com.intellij.ide.actions.CreateClassAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.actionSystem.LangDataKeys -import com.intellij.openapi.actionSystem.ex.ActionUtil.updateAction import com.intellij.openapi.actionSystem.impl.SimpleDataContext import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.roots.ModuleRootManager @@ -36,15 +35,14 @@ class CreateClassActionAvailabilityTest: JavaCodeInsightFixtureTestCase() { val projectDir = PsiManager.getInstance(project).findDirectory(baseDir)!! val action = CreateClassAction() val e: AnActionEvent = TestActionEvent.createTestEvent(context(projectDir)) - updateAction(action, e) - val enabledAndVisible = e.presentation.isEnabledAndVisible - return enabledAndVisible + action.update(e) + return e.presentation.isEnabledAndVisible } private fun context(projectDir: PsiDirectory): DataContext { return SimpleDataContext.builder().add(LangDataKeys.IDE_VIEW, object : IdeView { override fun getDirectories(): Array = arrayOf(projectDir) - override fun getOrChooseDirectory(): PsiDirectory? = projectDir + override fun getOrChooseDirectory(): PsiDirectory = projectDir }).add(LangDataKeys.PROJECT, this.project).build() } } \ No newline at end of file