From bf421107675d8ada77bb7526a6ee8a7fac506d92 Mon Sep 17 00:00:00 2001 From: Viuginov Nickolay Date: Tue, 23 Apr 2019 15:28:00 +0300 Subject: [PATCH] introduce XAttachDebugger#getDebuggerSelectedTitle which allows to customize title, while debugger is selected IDEA-CR-46575 RUBY-22071 GitOrigin-RevId: b612d3e72294a1557d692df23f1ca9b62ec94d5d --- .../intellij/xdebugger/attach/XAttachDebugger.java | 13 +++++++++++++ .../impl/actions/AttachToProcessActionBase.java | 5 +---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/attach/XAttachDebugger.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/attach/XAttachDebugger.java index 2d0c48842403..39e84396c8b9 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/attach/XAttachDebugger.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/attach/XAttachDebugger.java @@ -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. diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java index 27c250e3448a..de514802771e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java @@ -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) {