Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ActionUpdateThread.OLD_EDT deprecation on DumbAwareActions #2088

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -90,6 +92,11 @@ public boolean isDumbAware() {
return false;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

private Pair<PsiFile, PhpClass> findPhpClass(final @NotNull AnActionEvent event) {
final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -68,6 +70,11 @@ public boolean isDumbAware() {
return false;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

/**
* Get focused (target) element for the event.
*
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -75,6 +78,11 @@ public boolean isDumbAware() {
return false;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

private Pair<PsiFile, PhpClass> findPhpClass(@NotNull final AnActionEvent event) {
final PsiFile psiFile = event.getData(PlatformDataKeys.PSI_FILE);

Expand Down
Loading