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

Added getActionUpdateThread to all actions #6101

Merged
merged 1 commit into from
Feb 29, 2024
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 @@ -17,12 +17,20 @@

import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BuildSystemName;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

/** The "Blaze" menu group, only visible in blaze mode */
public class BlazeMenuGroup extends DefaultActionGroup {

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

@Override
public final void update(AnActionEvent e) {
// Don't hide the menu if project is null: it will be null temporarily while loading a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@

import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BuildSystemName;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import javax.annotation.Nullable;
import javax.swing.Icon;
import org.jetbrains.annotations.NotNull;

/** Base class action that hides for non-blaze projects. */
public abstract class BlazeProjectAction extends AnAction {
Expand Down Expand Up @@ -64,6 +66,11 @@ protected BlazeProjectAction(
super(text, description, icon);
}

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

@Override
public final void update(AnActionEvent e) {
Project project = e.getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
package com.google.idea.blaze.base.actions;

import com.google.idea.blaze.base.settings.Blaze;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.Project;
import javax.annotation.Nullable;
import javax.swing.Icon;
import org.jetbrains.annotations.NotNull;

/** Base class toggle action that hides for non-blaze projects. */
public abstract class BlazeProjectToggleAction extends ToggleAction {
Expand All @@ -35,6 +37,11 @@ protected BlazeProjectToggleAction(
super(text, description, icon);
}

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

@Override
public final void update(AnActionEvent e) {
Project project = e.getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
*/
package com.google.idea.blaze.base.ext;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import org.jetbrains.annotations.NotNull;

/** The menu for all intellij-ext actions */
public class IntelliJExtMenu extends DefaultActionGroup {
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

@Override
public void update(@NotNull AnActionEvent e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.google.idea.blaze.base.ext;

import com.google.idea.blaze.ext.IntelliJExtService;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;
Expand All @@ -29,6 +30,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {
new StatusDialog(e.getProject(), service).show();
}

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

@Override
public void update(@NotNull AnActionEvent e) {
boolean enabled = IntelliJExtManager.getInstance().isEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.idea.blaze.base.qsync.QuerySyncManager.TaskOrigin;
import com.google.idea.blaze.base.sync.status.BlazeSyncStatus;
import com.intellij.icons.AllIcons.Actions;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
Expand Down Expand Up @@ -78,6 +79,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {
TaskOrigin.USER_ACTION);
}

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

@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.intellij.icons.AllIcons.Actions;
import com.intellij.ide.HelpTooltip;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
Expand Down Expand Up @@ -97,6 +98,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {
e, PopupPositioner.showUnderneathClickedComponentOrCentered(e));
}

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

@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BlazeImportSettings.ProjectType;
import com.google.idea.blaze.base.sync.status.BlazeSyncStatus;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import org.jetbrains.annotations.NotNull;

/** An internal action to reload the querysync project. */
public class ReloadProject extends AnAction {
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

@Override
public void update(@NotNull AnActionEvent e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.intellij.execution.RunManager;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
Expand Down Expand Up @@ -68,6 +69,7 @@
import javax.swing.table.TableColumn;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.jetbrains.annotations.NotNull;

/** UI for exporting run configurations. */
public class ExportRunConfigurationDialog extends DialogWrapper {
Expand Down Expand Up @@ -257,6 +259,11 @@ private SelectAllButton() {
super("Select All", AllIcons.Actions.Selectall);
}

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

@Override
public synchronized void actionPerformed(AnActionEvent anActionEvent) {
boolean newState = !allSelected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.intellij.ide.actions.NextOccurenceToolbarAction;
import com.intellij.ide.actions.PreviousOccurenceToolbarAction;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
Expand All @@ -63,6 +64,7 @@
import javax.annotation.Nullable;
import javax.swing.JComponent;
import javax.swing.LayoutFocusTraversalPolicy;
import org.jetbrains.annotations.NotNull;

/** ConsoleView handles how the output of a single task is displayed in the tool-window. */
final class ConsoleView implements Disposable {
Expand Down Expand Up @@ -265,6 +267,11 @@ public void actionPerformed(AnActionEvent e) {
}
}

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

@Override
public void update(AnActionEvent event) {
event.getPresentation().setEnabled(stopHandler != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataKey;
Expand All @@ -51,6 +52,7 @@
import java.util.NoSuchElementException;
import javax.annotation.Nullable;
import javax.swing.JComponent;
import org.jetbrains.annotations.NotNull;

/** A custom error tree view panel for Blaze invocation errors. */
class BlazeProblemsViewPanel extends NewErrorTreeViewPanelAdapter {
Expand Down Expand Up @@ -173,6 +175,11 @@ public AutoscrollToConsoleAction() {
super("Autoscroll to console", "Autoscroll to console", AllIcons.Debugger.Console);
}

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

@Override
public boolean isSelected(AnActionEvent event) {
return configuration.getAutoscrollToConsole();
Expand Down Expand Up @@ -210,6 +217,11 @@ private class ShowWarningsAction extends ToggleAction implements DumbAware {
configuration = ErrorTreeViewConfiguration.getInstance(getProject());
}

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

@Override
public boolean isSelected(AnActionEvent event) {
return !configuration.isHideWarnings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

import com.google.idea.blaze.base.settings.Blaze;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.Messages;
import java.io.IOException;
import org.jetbrains.annotations.NotNull;

class BlazeImportProjectAction extends AnAction {
private static final Logger logger = Logger.getInstance(BlazeImportProjectAction.class);
Expand All @@ -47,6 +49,11 @@ protected ProjectImportWizardStep[] getSteps(WizardContext context) {
createFromWizard(projectCreator, wizard.context);
}

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

@Override
public void update(AnActionEvent e) {
super.update(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
package com.google.idea.common.actions;

import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.EmptyAction;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project;
import java.util.function.Predicate;
import org.jetbrains.annotations.NotNull;

/** Helper class to conditionally replace/hide existing actions. */
public class ReplaceActionHelper {
Expand Down Expand Up @@ -86,6 +88,11 @@ public void actionPerformed(AnActionEvent e) {
delegate.actionPerformed(e);
}

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

@Override
public void update(AnActionEvent e) {
Project project = e.getProject();
Expand Down Expand Up @@ -119,6 +126,11 @@ private ReplacedAction(
this.shouldReplace = shouldReplace;
}

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

@Override
public void update(AnActionEvent e) {
// default to visible and enabled, to handle the case where the delegate's update method
Expand Down
Loading