TestActionEvent cleanup 2

GitOrigin-RevId: 617de5980bcee07a7ad4c213039cc5684dac666e
This commit is contained in:
Gregory.Shrago
2022-11-25 02:59:14 +04:00
committed by intellij-monorepo-bot
parent bd4537d5c1
commit 60dfc9d563
25 changed files with 56 additions and 52 deletions

View File

@@ -38,7 +38,7 @@ class InlineModuleDependencyActionTest : JavaModuleTestCase() {
val classPathPanel = setUpClasspathPanel(modifiableRootModel, newModuleOrderEntry)
val action = InlineModuleDependencyAction(classPathPanel)
action.actionPerformed(TestActionEvent())
action.actionPerformed(TestActionEvent.createTestEvent())
val orderEntries = modifiableRootModel.moduleLibraryTable.libraries
TestCase.assertEquals(1, orderEntries.size)
@@ -65,7 +65,7 @@ class InlineModuleDependencyActionTest : JavaModuleTestCase() {
val classPathPanel = setUpClasspathPanel(modifiableRootModel, newModuleOrderEntry)
val action = InlineModuleDependencyAction(classPathPanel)
action.actionPerformed(TestActionEvent())
action.actionPerformed(TestActionEvent.createTestEvent())
val orderEntries = modifiableRootModel.orderEntries.filterIsInstance<LibraryOrderEntry>()
TestCase.assertEquals(1, orderEntries.size)
@@ -90,7 +90,7 @@ class InlineModuleDependencyActionTest : JavaModuleTestCase() {
val classPathPanel = setUpClasspathPanel(modifiableRootModel, newModuleOrderEntry)
val action = InlineModuleDependencyAction(classPathPanel)
action.actionPerformed(TestActionEvent())
action.actionPerformed(TestActionEvent.createTestEvent())
val orderEntries = modifiableRootModel.orderEntries.filterIsInstance<LibraryOrderEntry>()
TestCase.assertEquals(1, orderEntries.size)
@@ -129,7 +129,7 @@ class InlineModuleDependencyActionTest : JavaModuleTestCase() {
val classPathPanel = setUpClasspathPanel(modifiableRootModel, moduleOrderEntry)
val action = InlineModuleDependencyAction(classPathPanel)
action.actionPerformed(TestActionEvent())
action.actionPerformed(TestActionEvent.createTestEvent())
val orderEntries = modifiableRootModel.orderEntries
assertEquals(3, orderEntries.size)

View File

@@ -9,6 +9,7 @@ import com.intellij.execution.junit.JUnitConfiguration;
import com.intellij.execution.junit.codeInsight.JUnit5TestFrameworkSetupUtil;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.impl.NonBlockingReadActionImpl;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.testFramework.TestActionEvent;
@@ -183,9 +184,9 @@ public class NestedClassLineMarkerTest extends LightJavaCodeInsightFixtureTestCa
GutterIconRenderer mark = (GutterIconRenderer)marks.get(0);
ActionGroup group = mark.getPopupMenuActions();
assertNotNull(group);
TestActionEvent event = new TestActionEvent();
AnActionEvent event = TestActionEvent.createTestEvent();
List<AnAction> list = ContainerUtil.findAll(group.getChildren(event), action -> {
TestActionEvent actionEvent = new TestActionEvent();
AnActionEvent actionEvent = TestActionEvent.createTestEvent();
action.update(actionEvent);
String text = actionEvent.getPresentation().getText();
return text != null && text.startsWith("Run '") && text.endsWith("'");

View File

@@ -22,6 +22,7 @@ import com.intellij.execution.testframework.sm.runner.states.TestStateInfo;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.impl.NonBlockingReadActionImpl;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.extensions.LoadingOrder;
@@ -141,9 +142,9 @@ public class RunLineMarkerTest extends LightJavaCodeInsightFixtureTestCase {
GutterIconRenderer mark = (GutterIconRenderer)marks.get(0);
ActionGroup group = mark.getPopupMenuActions();
assertNotNull(group);
TestActionEvent event = new TestActionEvent();
AnActionEvent event = TestActionEvent.createTestEvent();
List<AnAction> list = ContainerUtil.findAll(group.getChildren(event), action -> {
TestActionEvent actionEvent = new TestActionEvent();
AnActionEvent actionEvent = TestActionEvent.createTestEvent();
action.update(actionEvent);
String text = actionEvent.getPresentation().getText();
return text != null && text.startsWith("Run '") && text.endsWith("'");
@@ -285,7 +286,7 @@ public class RunLineMarkerTest extends LightJavaCodeInsightFixtureTestCase {
List<GutterMark> marks = myFixture.findGuttersAtCaret();
assertEquals(1, marks.size());
GutterIconRenderer mark = (GutterIconRenderer)marks.get(0);
AnAction[] children = mark.getPopupMenuActions().getChildren(new TestActionEvent());
AnAction[] children = mark.getPopupMenuActions().getChildren(TestActionEvent.createTestEvent());
String message = ExecutionBundle.message("create.run.configuration.action.name");
AnAction action = ContainerUtil.find(children, t -> {
if (t.getTemplateText() == null) return false;
@@ -293,7 +294,7 @@ public class RunLineMarkerTest extends LightJavaCodeInsightFixtureTestCase {
});
assertNotNull(action);
myFixture.testAction(action);
TestActionEvent event = new TestActionEvent();
AnActionEvent event = TestActionEvent.createTestEvent();
action.update(event);
assertTrue(event.getPresentation().getText().startsWith(message));
ContainerUtil.addIfNotNull(myTempSettings, RunManager.getInstance(getProject()).getSelectedConfiguration());

View File

@@ -21,10 +21,7 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.testframework.TestSearchScope;
import com.intellij.java.execution.BaseConfigurationTestCase;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.ExecutionDataKeys;
import com.intellij.openapi.actionSystem.PlatformCoreDataKeys;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.util.text.StringUtil;
@@ -193,7 +190,7 @@ public class ContextConfigurationTest extends BaseConfigurationTestCase {
ExecutionEnvironment e = ExecutionEnvironmentBuilder.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), settings).build();
MapDataContext dataContext = new MapDataContext();
dataContext.put(ExecutionDataKeys.EXECUTION_ENVIRONMENT, e);
TestActionEvent event = new TestActionEvent(dataContext);
AnActionEvent event = TestActionEvent.createTestEvent(dataContext);
new CreateAction().update(event);
assertTrue(event.getPresentation().isEnabledAndVisible());
}

View File

@@ -8,6 +8,7 @@ import com.intellij.ide.hierarchy.actions.BrowseTypeHierarchyAction;
import com.intellij.ide.hierarchy.call.CalleeMethodsTreeStructure;
import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
@@ -117,7 +118,7 @@ public class JavaCallHierarchyTest extends HierarchyViewTestBase {
public void testActionAvailableInXml() {
configureByText(XmlFileType.INSTANCE, "<foo>java.lang.Str<caret>ing</foo>");
BrowseTypeHierarchyAction action = new BrowseTypeHierarchyAction();
TestActionEvent e = new TestActionEvent(action);
AnActionEvent e = TestActionEvent.createTestEvent(action);
assertTrue(ActionUtil.lastUpdateAndCheckDumb(action, e, true));
assertTrue(e.getPresentation().isEnabled() && e.getPresentation().isVisible());
}

View File

@@ -62,7 +62,7 @@ suspend fun performAction(
) {
withSelectedFileIfNeeded(selectedFile) {
withContext(Dispatchers.EDT) {
action.actionPerformed(TestActionEvent {
action.actionPerformed(TestActionEvent.createTestEvent {
when {
ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.`is`(it) -> systemId
CommonDataKeys.PROJECT.`is`(it) -> project

View File

@@ -11,6 +11,7 @@ import com.intellij.execution.impl.FakeConfigurationFactory;
import com.intellij.execution.impl.FakeRunConfiguration;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.extensions.ExtensionPoint;
@@ -110,7 +111,7 @@ public class ConfigurationContextTest extends BasePlatformTestCase {
assertEquals("hello_", configuration.getName());
addConfiguration(configuration);
DataContext context = createDataContext();
TestActionEvent event = new TestActionEvent(context);
AnActionEvent event = TestActionEvent.createTestEvent(context);
new RunNewConfigurationContextAction(DefaultRunExecutor.getRunExecutorInstance()).fullUpdate(event);
assertTrue(event.getPresentation().isEnabledAndVisible());
assertEquals("Run 'world_'", event.getPresentation().getText());
@@ -120,7 +121,7 @@ public class ConfigurationContextTest extends BasePlatformTestCase {
addConfiguration(configuration1);
DataContext context1 = createDataContext();
TestActionEvent event1 = new TestActionEvent(context1);
AnActionEvent event1 = TestActionEvent.createTestEvent(context1);
new RunNewConfigurationContextAction(DefaultRunExecutor.getRunExecutorInstance()).fullUpdate(event1);
assertTrue(event1.getPresentation().isEnabledAndVisible());
assertEquals("Run 'world_'", event1.getPresentation().getText());
@@ -163,12 +164,12 @@ public class ConfigurationContextTest extends BasePlatformTestCase {
DataContext context = createDataContext();
assertNull(ConfigurationContext.getFromContext(context, ActionPlaces.UNKNOWN).findExisting());
TestActionEvent event = new TestActionEvent(context);
AnActionEvent event = TestActionEvent.createTestEvent(context);
new RunNewConfigurationContextAction(DefaultRunExecutor.getRunExecutorInstance()).fullUpdate(event);
assertFalse(event.getPresentation().isEnabledAndVisible());
DataContext context1 = createDataContext();
TestActionEvent event1 = new TestActionEvent(context1);
AnActionEvent event1 = TestActionEvent.createTestEvent(context1);
new RunContextAction(DefaultRunExecutor.getRunExecutorInstance()).fullUpdate(event1);
assertTrue(event1.getPresentation().isEnabledAndVisible());
assertEquals("Run 'world_'", event1.getPresentation().getText());

View File

@@ -61,7 +61,7 @@ public class ConsoleHistoryControllerTest extends LightPlatformCodeInsightTestCa
private void executeCommand() {
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
myExecAction.actionPerformed(new TestActionEvent());
myExecAction.actionPerformed(TestActionEvent.createTestEvent());
}
private void execStatementList1() {

View File

@@ -300,7 +300,7 @@ public class ReformatOnlyVcsChangedTextTest extends LightPlatformTestCase {
OptimizeImportsAction optimizeImports = new OptimizeImportsAction();
OptimizeImportsAction.setProcessVcsChangedFilesInTests(true);
try {
optimizeImports.actionPerformed(new TestActionEvent(dataId -> {
optimizeImports.actionPerformed(TestActionEvent.createTestEvent(dataId -> {
if (CommonDataKeys.PROJECT.is(dataId)) {
return getProject();
}

View File

@@ -448,7 +448,7 @@ public class JarFileSystemTest extends BareTestFixtureTestCase {
assertNull(VirtualFileManager.getInstance().findFileByUrl(fileUrl));
CorruptedJarFileSystemTestWrapper.corrupted = false;
var event = new TestActionEvent(
var event = TestActionEvent.createTestEvent(
dataId -> CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId) ? new VirtualFile[]{root} :
CommonDataKeys.PROJECT.is(dataId) ? DefaultProjectFactory.getInstance().getDefaultProject() :
null);

View File

@@ -29,19 +29,23 @@ public final class TestActionEvent extends AnActionEvent {
private static final String PLACE = "";
@Deprecated(forRemoval = true)
public TestActionEvent(@NotNull DataContext dataContext,
@NotNull AnAction action) {
super(null, dataContext, PLACE, action.getTemplatePresentation().clone(), ActionManager.getInstance(), 0);
}
@Deprecated(forRemoval = true)
public TestActionEvent(@NotNull AnAction action) {
this(DataManager.getInstance().getDataContext(), action);
}
@Deprecated(forRemoval = true)
public TestActionEvent(DataContext context) {
super(null, context, PLACE, new Presentation(), ActionManager.getInstance(), 0);
}
@Deprecated(forRemoval = true)
public TestActionEvent() {
super(null, DataManager.getInstance().getDataContext(), PLACE, new Presentation(), ActionManager.getInstance(), 0);
}

View File

@@ -948,7 +948,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@NotNull
@Override
public Presentation testAction(@NotNull AnAction action) {
TestActionEvent e = new TestActionEvent(action);
AnActionEvent e = TestActionEvent.createTestEvent(action);
if (ActionUtil.lastUpdateAndCheckDumb(action, e, true)) {
ActionUtil.performActionDumbAwareWithCallbacks(action, e);
}

View File

@@ -139,7 +139,7 @@ abstract class GradleRerunFailedTestsTestCase : GradleImportingTestCase() {
fun performRerunFailedTestsAction(): Boolean = invokeAndWaitIfNeeded {
val rerunAction = GradleRerunFailedTestsAction(testExecutionConsole)
rerunAction.setModelProvider { testExecutionConsole.resultsViewer }
val actionEvent = TestActionEvent(
val actionEvent = TestActionEvent.createTestEvent(
SimpleDataContext.builder()
.add(ExecutionDataKeys.EXECUTION_ENVIRONMENT, testExecutionEnvironment)
.add(CommonDataKeys.PROJECT, myProject)

View File

@@ -22,10 +22,10 @@ import com.intellij.testFramework.TestActionEvent
import com.intellij.testIntegration.TestRunLineMarkerProvider
import com.intellij.util.LocalTimeCounter
import org.jetbrains.plugins.gradle.importing.GradleImportingTestCase
import org.jetbrains.plugins.gradle.testFramework.util.buildscript
import org.jetbrains.plugins.gradle.service.execution.GradleExternalTaskConfigurationType
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
import org.jetbrains.plugins.gradle.testFramework.util.buildSettings
import org.jetbrains.plugins.gradle.testFramework.util.buildscript
import org.jetbrains.plugins.gradle.util.GradleConstants
import org.jetbrains.plugins.gradle.util.findChildByType
import org.jetbrains.plugins.gradle.util.runReadActionAndWait
@@ -47,7 +47,7 @@ abstract class GradleTestRunConfigurationProducerTestCase : GradleImportingTestC
val info = TestRunLineMarkerProvider().getInfo(identifier)!!
val runAction = info.actions.first() as ExecutorAction
val context = getContextByLocation(element)
runAction.getChildren(TestActionEvent(context.dataContext))
runAction.getChildren(TestActionEvent.createTestEvent(context.dataContext))
}
protected fun assertGutterRunActionsSize(element: PsiNameIdentifierOwner, expectedSize: Int) {

View File

@@ -48,7 +48,7 @@ class Test {
new GroovyGenerateToStringAction()
]
actions.each {
def event = new TestActionEvent(getCurrentEditorDataContext(), it)
def event = TestActionEvent.createTestEvent(it, getCurrentEditorDataContext())
it.update(event)
assert event.presentation.enabledAndVisible
}
@@ -74,7 +74,7 @@ class Test {
new GroovyGenerateToStringAction()
]
actions.each {
def event = new TestActionEvent(getCurrentEditorDataContext(), it)
def event = TestActionEvent.createTestEvent(it, getCurrentEditorDataContext())
it.update(event)
assert !event.presentation.enabledAndVisible
}

View File

@@ -35,7 +35,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
}
protected open fun testAction(action: AnAction, forced: Boolean): Presentation {
val e = TestActionEvent(action)
val e = TestActionEvent.createTestEvent(action)
if (ActionUtil.lastUpdateAndCheckDumb(action, e, true) || forced) {
ActionUtil.performActionDumbAwareWithCallbacks(action,e)
}

View File

@@ -220,9 +220,9 @@ fun main(args: Array<String>) {}
val mark = marks[0] as GutterIconRenderer
val group = mark.popupMenuActions
assertNotNull(group)
val event = TestActionEvent()
val event = TestActionEvent.createTestEvent()
val list = ContainerUtil.findAll(group!!.getChildren(event)) { action: AnAction ->
val actionEvent = TestActionEvent()
val actionEvent = TestActionEvent.createTestEvent()
action.update(actionEvent)
val text = actionEvent.presentation.text
text != null && text.startsWith("Run '") && text.endsWith("'")

View File

@@ -6,6 +6,7 @@ import com.intellij.ide.scratch.ScratchFileService
import com.intellij.ide.scratch.ScratchRootType
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ex.ActionUtil
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.fileEditor.TextEditor
@@ -23,9 +24,9 @@ import com.intellij.util.ThrowableRunnable
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.actions.KOTLIN_WORKSHEET_EXTENSION
import org.jetbrains.kotlin.idea.base.highlighting.shouldHighlightFile
import org.jetbrains.kotlin.idea.base.plugin.artifacts.TestKotlinArtifacts
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
import org.jetbrains.kotlin.idea.base.highlighting.shouldHighlightFile
import org.jetbrains.kotlin.idea.scratch.actions.ClearScratchAction
import org.jetbrains.kotlin.idea.scratch.actions.RunScratchAction
import org.jetbrains.kotlin.idea.scratch.actions.ScratchCompilationSupport
@@ -295,9 +296,9 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
UIUtil.dispatchAllInvocationEvents()
}
private fun getActionEvent(action: AnAction): TestActionEvent {
private fun getActionEvent(action: AnAction): AnActionEvent {
val context = TestDataProvider(project)
return TestActionEvent(context::getData, action)
return TestActionEvent.createTestEvent(action, context::getData)
}
protected fun doTestScratchText(): String {

View File

@@ -1,13 +1,13 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.project.actions
import com.intellij.maven.testFramework.MavenMultiVersionImportingTestCase
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.application.WriteAction
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiManager
import com.intellij.testFramework.MapDataContext
import com.intellij.testFramework.TestActionEvent
import com.intellij.maven.testFramework.MavenMultiVersionImportingTestCase
import org.junit.Test
class AddFileAsMavenProjectActionTest : MavenMultiVersionImportingTestCase() {
@@ -31,7 +31,7 @@ class AddFileAsMavenProjectActionTest : MavenMultiVersionImportingTestCase() {
val context = MapDataContext()
context.put(CommonDataKeys.PROJECT, myProject)
context.put(CommonDataKeys.VIRTUAL_FILE, projectPom)
val event = TestActionEvent(context)
val event = TestActionEvent.createTestEvent(context)
AddFileAsMavenProjectAction().actionPerformed(event)
val promise = myProjectsManager.waitForImportCompletion()

View File

@@ -30,8 +30,8 @@ public class ReimportProjectActionTest extends MavenMultiVersionImportingTestCas
importProject();
var action = new ReimportProjectAction();
var parentActionVisible = action.isVisible(new TestActionEvent(createTestDataContext(parentFile), action));
var m1ActionVisible = action.isVisible(new TestActionEvent(createTestDataContext(m1File), action));
var parentActionVisible = action.isVisible(TestActionEvent.createTestEvent(action, createTestDataContext(parentFile)));
var m1ActionVisible = action.isVisible(TestActionEvent.createTestEvent(action, createTestDataContext(m1File)));
assertTrue(parentActionVisible);
assertTrue(m1ActionVisible);
@@ -43,7 +43,7 @@ public class ReimportProjectActionTest extends MavenMultiVersionImportingTestCas
myProjectsManager.setIgnoredState(Collections.singletonList(mavenProject), true);
assertTrue(myProjectsManager.isIgnored(mavenProject));
var m1IgnoredActionVisible = action.isVisible(new TestActionEvent(createTestDataContext(m1File), action));
var m1IgnoredActionVisible = action.isVisible(TestActionEvent.createTestEvent(action, createTestDataContext(m1File)));
assertFalse(m1IgnoredActionVisible);
}
}

View File

@@ -28,8 +28,8 @@ public class RemoveManagedFilesActionTest extends MavenMultiVersionImportingTest
importProject();
var action = new RemoveManagedFilesAction();
var parentActionVisible = action.isVisible(new TestActionEvent(createTestDataContext(parentFile), action));
var m1ActionVisible = action.isVisible(new TestActionEvent(createTestDataContext(m1File), action));
var parentActionVisible = action.isVisible(TestActionEvent.createTestEvent(action, createTestDataContext(parentFile)));
var m1ActionVisible = action.isVisible(TestActionEvent.createTestEvent(action, createTestDataContext(m1File)));
assertTrue(parentActionVisible);
assertFalse(m1ActionVisible);

View File

@@ -1325,7 +1325,7 @@ public class MavenProjectsManagerTest extends MavenMultiVersionImportingTestCase
configConfirmationForYesAnswer();
RemoveManagedFilesAction action = new RemoveManagedFilesAction();
action.actionPerformed(new TestActionEvent(createTestDataContext(mavenParentPom), action));
action.actionPerformed(TestActionEvent.createTestEvent(action, createTestDataContext(mavenParentPom)));
assertEquals(1, ModuleManager.getInstance(myProject).getModules().length);
assertEquals("non-maven", ModuleManager.getInstance(myProject).getModules()[0].getName());
assertEmpty(myProjectsManager.getIgnoredFilesPaths());

View File

@@ -40,10 +40,10 @@ public class TaskUiTest extends CodeInsightFixtureTestCase {
SwitchTaskAction combo = null;
ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_MAIN_TOOLBAR);
ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.MAIN_TOOLBAR, group, true);
AnAction[] children = group.getChildren(new TestActionEvent());
AnAction[] children = group.getChildren(TestActionEvent.createTestEvent());
for (AnAction child : children) {
if (child instanceof ActionGroup) {
AnAction[] actions = ((ActionGroup)child).getChildren(new TestActionEvent());
AnAction[] actions = ((ActionGroup)child).getChildren(TestActionEvent.createTestEvent());
for (AnAction action : actions) {
if (action instanceof SwitchTaskAction) {
combo = (SwitchTaskAction)action;

View File

@@ -1,10 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.actions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.PlatformCoreDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
@@ -122,7 +119,7 @@ public class PyMarkAsNamespacePackageActionTest extends PyTestCase {
mapDataContext.put(PlatformCoreDataKeys.MODULE, myFixture.getModule());
AnAction action = new PyMarkAsNamespacePackageAction();
TestActionEvent e = new TestActionEvent(mapDataContext, action);
AnActionEvent e = TestActionEvent.createTestEvent(action, mapDataContext);
if (ActionUtil.lastUpdateAndCheckDumb(action, e, true)) {
ActionUtil.performActionDumbAwareWithCallbacks(action, e);
}

View File

@@ -2,6 +2,7 @@
package com.jetbrains.python.refactoring;
import com.google.common.collect.Lists;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
@@ -41,7 +42,7 @@ public class PyInvertBooleanTest extends PyTestCase {
assertTrue(element instanceof PsiNamedElement);
final InvertBooleanAction action = new InvertBooleanAction();
final TestActionEvent event = new TestActionEvent(action);
final AnActionEvent event = TestActionEvent.createTestEvent(action);
assertTrue(ActionUtil.lastUpdateAndCheckDumb(action, event, true));
assertTrue(event.getPresentation().isEnabledAndVisible());