Skip to content

Commit ac57672

Browse files
authored
Merge pull request #2088 from piotrkwiecinski/additional-old-edt-fixes
fix ActionUpdateThread.OLD_EDT deprecation on DumbAwareActions
2 parents 424c0c0 + 64ebdb4 commit ac57672

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package com.magento.idea.magento2plugin.actions.generation;
77

8+
import com.intellij.openapi.actionSystem.ActionUpdateThread;
9+
import com.intellij.openapi.actionSystem.ActionUpdateThreadAware;
810
import com.intellij.openapi.actionSystem.AnActionEvent;
911
import com.intellij.openapi.actionSystem.PlatformDataKeys;
1012
import com.intellij.openapi.editor.Caret;
@@ -24,7 +26,7 @@
2426
import com.magento.idea.magento2plugin.util.magento.plugin.IsPluginAllowedForMethodUtil;
2527
import org.jetbrains.annotations.NotNull;
2628

27-
public class CreateAPluginAction extends DumbAwareAction {
29+
public class CreateAPluginAction extends DumbAwareAction implements ActionUpdateThreadAware {
2830

2931
public static final String ACTION_NAME = "Create a new Plugin";
3032
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Plugin";
@@ -90,6 +92,11 @@ public boolean isDumbAware() {
9092
return false;
9193
}
9294

95+
@Override
96+
public @NotNull ActionUpdateThread getActionUpdateThread() {
97+
return ActionUpdateThread.BGT;
98+
}
99+
93100
private Pair<PsiFile, PhpClass> findPhpClass(final @NotNull AnActionEvent event) {
94101
final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);
95102

src/com/magento/idea/magento2plugin/actions/generation/CreateAnObserverAction.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
package com.magento.idea.magento2plugin.actions.generation;
77

88
import com.intellij.lang.ASTNode;
9+
import com.intellij.openapi.actionSystem.ActionUpdateThread;
10+
import com.intellij.openapi.actionSystem.ActionUpdateThreadAware;
911
import com.intellij.openapi.actionSystem.AnActionEvent;
1012
import com.intellij.openapi.actionSystem.PlatformDataKeys;
1113
import com.intellij.openapi.editor.Caret;
@@ -28,7 +30,8 @@
2830
import com.magento.idea.magento2plugin.project.Settings;
2931
import org.jetbrains.annotations.NotNull;
3032

31-
public class CreateAnObserverAction extends DumbAwareAction {
33+
public class CreateAnObserverAction extends DumbAwareAction
34+
implements ActionUpdateThreadAware {
3235

3336
public static final String ACTION_NAME = "Create a new Observer for this event";
3437
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Observer";
@@ -87,6 +90,11 @@ public boolean isDumbAware() {
8790
return false;
8891
}
8992

93+
@Override
94+
public @NotNull ActionUpdateThread getActionUpdateThread() {
95+
return ActionUpdateThread.BGT;
96+
}
97+
9098
private PsiElement getElement(final @NotNull AnActionEvent event) {
9199
final Caret caret = event.getData(PlatformDataKeys.CARET);
92100

src/com/magento/idea/magento2plugin/actions/generation/InjectAViewModelAction.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package com.magento.idea.magento2plugin.actions.generation;
77

8+
import com.intellij.openapi.actionSystem.ActionUpdateThread;
9+
import com.intellij.openapi.actionSystem.ActionUpdateThreadAware;
810
import com.intellij.openapi.actionSystem.AnActionEvent;
911
import com.intellij.openapi.actionSystem.PlatformDataKeys;
1012
import com.intellij.openapi.editor.Caret;
@@ -21,7 +23,7 @@
2123
import com.magento.idea.magento2plugin.project.Settings;
2224
import org.jetbrains.annotations.NotNull;
2325

24-
public class InjectAViewModelAction extends DumbAwareAction {
26+
public class InjectAViewModelAction extends DumbAwareAction implements ActionUpdateThreadAware {
2527

2628
public static final String ACTION_NAME = "Inject a new View Model for this block";
2729
public static final String ACTION_DESCRIPTION = "Inject a new Magento 2 View Model";
@@ -68,6 +70,11 @@ public boolean isDumbAware() {
6870
return false;
6971
}
7072

73+
@Override
74+
public @NotNull ActionUpdateThread getActionUpdateThread() {
75+
return ActionUpdateThread.BGT;
76+
}
77+
7178
/**
7279
* Get focused (target) element for the event.
7380
*
@@ -98,7 +105,7 @@ private XmlTag getElement(final @NotNull AnActionEvent event) {
98105
if (xmlTag == null) {
99106
return null;
100107
}
101-
XmlTag resultTag;
108+
final XmlTag resultTag;
102109

103110
if (CommonXml.ATTRIBUTE_ARGUMENTS.equals(xmlTag.getName())) {
104111
resultTag = PsiTreeUtil.getParentOfType(xmlTag, XmlTag.class);

src/com/magento/idea/magento2plugin/actions/generation/OverrideClassByAPreferenceAction.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package com.magento.idea.magento2plugin.actions.generation;
77

8+
import com.intellij.openapi.actionSystem.ActionUpdateThread;
9+
import com.intellij.openapi.actionSystem.ActionUpdateThreadAware;
810
import com.intellij.openapi.actionSystem.AnActionEvent;
911
import com.intellij.openapi.actionSystem.PlatformDataKeys;
1012
import com.intellij.openapi.project.DumbAwareAction;
@@ -19,7 +21,8 @@
1921
import com.magento.idea.magento2plugin.util.GetFirstClassOfFile;
2022
import org.jetbrains.annotations.NotNull;
2123

22-
public class OverrideClassByAPreferenceAction extends DumbAwareAction {
24+
public class OverrideClassByAPreferenceAction extends DumbAwareAction
25+
implements ActionUpdateThreadAware {
2326
public static final String ACTION_NAME = "Override this class by a new Preference";
2427
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Preference";
2528
public static final String INTERFACE_ACTION = "Override this interface by a new Preference";
@@ -75,6 +78,11 @@ public boolean isDumbAware() {
7578
return false;
7679
}
7780

81+
@Override
82+
public @NotNull ActionUpdateThread getActionUpdateThread() {
83+
return ActionUpdateThread.BGT;
84+
}
85+
7886
private Pair<PsiFile, PhpClass> findPhpClass(@NotNull final AnActionEvent event) {
7987
final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);
8088

0 commit comments

Comments
 (0)