Skip to content

Commit 715eab2

Browse files
Resolved override-only method usage violation in AnAction.actionPerformed(AnActionEvent) (#1468)
* Resolved deprecation issue by replacing actionPerformed api to performActionDumbAwareWithCallbacks * Introduced action event variable * Added copyright year
1 parent c796804 commit 715eab2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/java/io/openliberty/tools/intellij/actions/RunLibertyDevTask.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2020, 2024 IBM Corporation.
2+
* Copyright (c) 2020, 2025 IBM Corporation.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
@@ -11,6 +11,7 @@
1111

1212
import com.intellij.ide.DataManager;
1313
import com.intellij.openapi.actionSystem.*;
14+
import com.intellij.openapi.actionSystem.ex.ActionUtil;
1415
import com.intellij.openapi.diagnostic.Logger;
1516
import com.intellij.openapi.project.Project;
1617
import com.intellij.openapi.wm.ToolWindow;
@@ -81,7 +82,8 @@ private void handleLibertyTreeEvent(@NotNull AnActionEvent e, Project project, b
8182
} else {
8283
// calls selected action
8384
AnAction action = ActionManager.getInstance().getAction(Constants.FULL_ACTIONS_MAP.get(lastPathComponent));
84-
action.actionPerformed(new AnActionEvent(DataManager.getInstance().getDataContext(libertyTree), e.getPresentation(), e.getPlace(), ActionUiKind.NONE, null, 0, ActionManager.getInstance()));
85+
AnActionEvent event = new AnActionEvent(DataManager.getInstance().getDataContext(libertyTree), e.getPresentation(), e.getPlace(), ActionUiKind.NONE, null, 0, ActionManager.getInstance());
86+
ActionUtil.performActionDumbAwareWithCallbacks(action, event);
8587
}
8688
}
8789
}
@@ -117,7 +119,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {
117119
String selectedAction = libertyActions[ret];
118120
// run selected action
119121
AnAction action = ActionManager.getInstance().getAction(Constants.FULL_ACTIONS_MAP.get(selectedAction));
120-
action.actionPerformed(new AnActionEvent(e.getDataContext(), e.getPresentation(), e.getPlace(), ActionUiKind.NONE, null, 0, ActionManager.getInstance()));
122+
AnActionEvent event = new AnActionEvent(e.getDataContext(), e.getPresentation(), e.getPlace(), ActionUiKind.NONE, null, 0, ActionManager.getInstance());
123+
ActionUtil.performActionDumbAwareWithCallbacks(action, event);
121124
}
122125
} else {
123126
handleLibertyTreeEvent(e, project, false);

src/main/java/io/openliberty/tools/intellij/runConfiguration/LibertyRunConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.intellij.execution.executors.DefaultDebugExecutor;
1616
import com.intellij.execution.runners.ExecutionEnvironment;
1717
import com.intellij.openapi.actionSystem.*;
18+
import com.intellij.openapi.actionSystem.ex.ActionUtil;
1819
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
1920
import com.intellij.openapi.diagnostic.Logger;
2021
import com.intellij.openapi.module.Module;
@@ -159,7 +160,7 @@ public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEn
159160
.build();
160161

161162
AnActionEvent event = new AnActionEvent(dataCtx, new Presentation(), ActionPlaces.UNKNOWN, ActionUiKind.NONE, null, 0, ActionManager.getInstance());
162-
action.actionPerformed(event);
163+
ActionUtil.performActionDumbAwareWithCallbacks(action, event);
163164

164165
// return null because we are not plugging into "Run" tool window in IntelliJ, just terminal and Debug
165166
return null;

0 commit comments

Comments
 (0)