mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
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
This commit is contained in:
committed by
intellij-monorepo-bot
parent
737852c635
commit
903b720631
@@ -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<out PsiDirectory> = arrayOf(projectDir)
|
||||
override fun getOrChooseDirectory(): PsiDirectory? = projectDir
|
||||
override fun getOrChooseDirectory(): PsiDirectory = projectDir
|
||||
}).add(LangDataKeys.PROJECT, this.project).build()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user