Skip to content

Commit

Permalink
Merge branch '5.3.0-develop' into hotfix-thread-exists
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaliyBoyko committed Jul 13, 2024
2 parents 920d983 + ac57672 commit 9515a03
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
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

0 comments on commit 9515a03

Please sign in to comment.