introduce XAttachDebugger#getDebuggerSelectedTitle which allows to customize title, while debugger is selected

IDEA-CR-46575
RUBY-22071

GitOrigin-RevId: b612d3e72294a1557d692df23f1ca9b62ec94d5d
This commit is contained in:
Viuginov Nickolay
2019-04-29 16:52:41 +03:00
committed by intellij-monorepo-bot
parent a154ad9846
commit bf42110767
2 changed files with 14 additions and 4 deletions
@@ -18,8 +18,11 @@ package com.intellij.xdebugger.attach;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.process.ProcessInfo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.xdebugger.XDebuggerBundle;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* {@link XAttachDebugger} allows to attach to process with specified {@link ProcessInfo}
@@ -29,6 +32,16 @@ public interface XAttachDebugger {
@NotNull
String getDebuggerDisplayName();
/**
* @return title for `Attach to process` module window, which will be shown when choosing this debugger
*/
@Nullable
default String getDebuggerSelectedTitle() {
String title = getDebuggerDisplayName();
title = StringUtil.shortenTextWithEllipsis(title, 50, 0);
return XDebuggerBundle.message("xdebugger.attach.popup.title", title);
}
/**
* Attaches this debugger to the specified process. The debugger is guaranteed to be
* returned by {@link XAttachDebuggerProvider#getAvailableDebuggers} for the specified process.
@@ -107,10 +107,7 @@ public abstract class AttachToProcessActionBase extends AnAction {
}
if (item instanceof AttachToProcessItem) {
String debuggerName = ((AttachToProcessItem)item).getSelectedDebugger().getDebuggerDisplayName();
debuggerName = StringUtil.shortenTextWithEllipsis(debuggerName, 50, 0);
popup.setCaption(XDebuggerBundle.message("xdebugger.attach.popup.title", debuggerName));
popup.setCaption(((AttachToProcessItem)item).getSelectedDebugger().getDebuggerSelectedTitle());
}
if (item instanceof AttachHostItem) {