don't show remote hosts in Attach to process with profiler action

IDEA-CR-44805

(cherry picked from commit b389e3d2b4fd519030772f519b02539ca06eba4a)
This commit is contained in:
Viuginov Nickolay
2019-03-21 21:42:26 +03:00
parent 27663069fa
commit a928b7d14f
2 changed files with 18 additions and 9 deletions
@@ -4,6 +4,7 @@ package com.intellij.xdebugger.impl.actions;
import com.intellij.icons.AllIcons;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.attach.XAttachDebuggerProvider;
import com.intellij.xdebugger.attach.XAttachHostProvider;
public class AttachToProcessAction extends AttachToProcessActionBase {
public AttachToProcessAction() {
@@ -11,6 +12,7 @@ public class AttachToProcessAction extends AttachToProcessActionBase {
XDebuggerBundle.message("xdebugger.attach.action.description"),
AllIcons.Debugger.AttachToProcess,
() -> XAttachDebuggerProvider.getAttachDebuggerProviders(),
() -> XAttachHostProvider.EP.getExtensionList(),
XDebuggerBundle.message("xdebugger.attach.popup.selectDebugger.title")
);
}
@@ -47,16 +47,23 @@ public abstract class AttachToProcessActionBase extends AnAction {
Key.create("AttachToProcessAction.RECENT_ITEMS_KEY");
private static final Logger LOG = Logger.getInstance(AttachToProcessActionBase.class);
private final Supplier<? extends List<XAttachDebuggerProvider>> attachProvidersSupplier;
private final String attachActionsListTitle;
@NotNull
private final Supplier<? extends List<XAttachDebuggerProvider>> myAttachProvidersSupplier;
@NotNull
private final String myAttachActionsListTitle;
@NotNull
private final Supplier<? extends List<XAttachHostProvider>> myAttachHostProviderSupplier;
public AttachToProcessActionBase(@Nullable String text,
@Nullable String description,
@Nullable Icon icon, @NotNull Supplier<? extends List<XAttachDebuggerProvider>> attachProvidersSupplier,
@Nullable Icon icon,
@NotNull Supplier<? extends List<XAttachDebuggerProvider>> attachProvidersSupplier,
@NotNull Supplier<? extends List<XAttachHostProvider>> attachHostProviderSupplier,
@NotNull String attachActionsListTitle) {
super(text, description, icon);
this.attachProvidersSupplier = attachProvidersSupplier;
this.attachActionsListTitle = attachActionsListTitle;
myAttachProvidersSupplier = attachProvidersSupplier;
myAttachActionsListTitle = attachActionsListTitle;
myAttachHostProviderSupplier = attachHostProviderSupplier;
}
@Override
@@ -64,7 +71,7 @@ public abstract class AttachToProcessActionBase extends AnAction {
super.update(e);
Project project = getEventProject(e);
int attachDebuggerProvidersNumber = attachProvidersSupplier.get().size();
int attachDebuggerProvidersNumber = myAttachProvidersSupplier.get().size();
boolean enabled = project != null && attachDebuggerProvidersNumber > 0;
e.getPresentation().setEnabledAndVisible(enabled);
}
@@ -163,7 +170,7 @@ public abstract class AttachToProcessActionBase extends AnAction {
UserDataHolderBase dataHolder = new UserDataHolderBase();
for (XAttachHostProvider hostProvider : XAttachHostProvider.EP.getExtensionList()) {
for (XAttachHostProvider hostProvider : myAttachHostProviderSupplier.get()) {
indicator.checkCanceled();
//noinspection unchecked
Set<XAttachHost> hosts = new HashSet<>(hostProvider.getAvailableHosts(project));
@@ -234,7 +241,7 @@ public abstract class AttachToProcessActionBase extends AnAction {
@NotNull
private List<XAttachDebuggerProvider> getProvidersApplicableForHost(@NotNull XAttachHost host) {
return ContainerUtil.filter(attachProvidersSupplier.get(), provider -> provider.isAttachHostApplicable(host));
return ContainerUtil.filter(myAttachProvidersSupplier.get(), provider -> provider.isAttachHostApplicable(host));
}
@NotNull
@@ -695,7 +702,7 @@ public abstract class AttachToProcessActionBase extends AnAction {
private class ActionListStep extends MyBasePopupStep<AttachToProcessItem> {
ActionListStep(List<AttachToProcessItem> items, int selectedItem) {
super(AttachListStep.this.myProject, AttachToProcessActionBase.this.attachActionsListTitle, items);
super(AttachListStep.this.myProject, AttachToProcessActionBase.this.myAttachActionsListTitle, items);
setDefaultOptionIndex(selectedItem);
}