diff --git a/src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java b/src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java index 4aabe0fe9..3411a9dd1 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/CreateAPluginAction.java @@ -5,6 +5,8 @@ package com.magento.idea.magento2plugin.actions.generation; +import com.intellij.openapi.actionSystem.ActionUpdateThread; +import com.intellij.openapi.actionSystem.ActionUpdateThreadAware; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Caret; @@ -24,7 +26,7 @@ import com.magento.idea.magento2plugin.util.magento.plugin.IsPluginAllowedForMethodUtil; import org.jetbrains.annotations.NotNull; -public class CreateAPluginAction extends DumbAwareAction { +public class CreateAPluginAction extends DumbAwareAction implements ActionUpdateThreadAware { public static final String ACTION_NAME = "Create a new Plugin"; public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Plugin"; @@ -90,6 +92,11 @@ public boolean isDumbAware() { return false; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + private Pair findPhpClass(final @NotNull AnActionEvent event) { final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE); diff --git a/src/com/magento/idea/magento2plugin/actions/generation/CreateAnObserverAction.java b/src/com/magento/idea/magento2plugin/actions/generation/CreateAnObserverAction.java index e50692c0d..c829bd732 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/CreateAnObserverAction.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/CreateAnObserverAction.java @@ -6,6 +6,8 @@ package com.magento.idea.magento2plugin.actions.generation; import com.intellij.lang.ASTNode; +import com.intellij.openapi.actionSystem.ActionUpdateThread; +import com.intellij.openapi.actionSystem.ActionUpdateThreadAware; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Caret; @@ -28,7 +30,8 @@ import com.magento.idea.magento2plugin.project.Settings; import org.jetbrains.annotations.NotNull; -public class CreateAnObserverAction extends DumbAwareAction { +public class CreateAnObserverAction extends DumbAwareAction + implements ActionUpdateThreadAware { public static final String ACTION_NAME = "Create a new Observer for this event"; public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Observer"; @@ -87,6 +90,11 @@ public boolean isDumbAware() { return false; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + private PsiElement getElement(final @NotNull AnActionEvent event) { final Caret caret = event.getData(PlatformDataKeys.CARET); diff --git a/src/com/magento/idea/magento2plugin/actions/generation/InjectAViewModelAction.java b/src/com/magento/idea/magento2plugin/actions/generation/InjectAViewModelAction.java index 682f50b04..dcf62e7fd 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/InjectAViewModelAction.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/InjectAViewModelAction.java @@ -5,6 +5,8 @@ package com.magento.idea.magento2plugin.actions.generation; +import com.intellij.openapi.actionSystem.ActionUpdateThread; +import com.intellij.openapi.actionSystem.ActionUpdateThreadAware; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Caret; @@ -21,7 +23,7 @@ import com.magento.idea.magento2plugin.project.Settings; import org.jetbrains.annotations.NotNull; -public class InjectAViewModelAction extends DumbAwareAction { +public class InjectAViewModelAction extends DumbAwareAction implements ActionUpdateThreadAware { public static final String ACTION_NAME = "Inject a new View Model for this block"; public static final String ACTION_DESCRIPTION = "Inject a new Magento 2 View Model"; @@ -68,6 +70,11 @@ public boolean isDumbAware() { return false; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + /** * Get focused (target) element for the event. * @@ -98,7 +105,7 @@ private XmlTag getElement(final @NotNull AnActionEvent event) { if (xmlTag == null) { return null; } - XmlTag resultTag; + final XmlTag resultTag; if (CommonXml.ATTRIBUTE_ARGUMENTS.equals(xmlTag.getName())) { resultTag = PsiTreeUtil.getParentOfType(xmlTag, XmlTag.class); diff --git a/src/com/magento/idea/magento2plugin/actions/generation/OverrideClassByAPreferenceAction.java b/src/com/magento/idea/magento2plugin/actions/generation/OverrideClassByAPreferenceAction.java index 1daf41ed0..82e749de6 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/OverrideClassByAPreferenceAction.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/OverrideClassByAPreferenceAction.java @@ -5,6 +5,8 @@ package com.magento.idea.magento2plugin.actions.generation; +import com.intellij.openapi.actionSystem.ActionUpdateThread; +import com.intellij.openapi.actionSystem.ActionUpdateThreadAware; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.project.DumbAwareAction; @@ -19,7 +21,8 @@ import com.magento.idea.magento2plugin.util.GetFirstClassOfFile; import org.jetbrains.annotations.NotNull; -public class OverrideClassByAPreferenceAction extends DumbAwareAction { +public class OverrideClassByAPreferenceAction extends DumbAwareAction + implements ActionUpdateThreadAware { public static final String ACTION_NAME = "Override this class by a new Preference"; public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Preference"; public static final String INTERFACE_ACTION = "Override this interface by a new Preference"; @@ -75,6 +78,11 @@ public boolean isDumbAware() { return false; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + private Pair findPhpClass(@NotNull final AnActionEvent event) { final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);