mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
terminal: support new terminal tab rename (IDEA-331247)
GitOrigin-RevId: a28d40ff7916bfdb620691da4a72d6ab5eb24b72
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b85b0246f3
commit
8bab980bbd
@@ -63,6 +63,10 @@ class TerminalTitle {
|
||||
return if (tag != null) "$title ($tag)" else title
|
||||
}
|
||||
|
||||
fun buildFullTitle(): @Nls String {
|
||||
return userDefinedTitle ?: applicationTitle ?: defaultTitle ?: ExecutionBundle.message("terminal.default.title")
|
||||
}
|
||||
|
||||
private fun shortenApplicationTitle(): String? {
|
||||
return StringUtil.trimMiddle(applicationTitle ?: return null, 30)
|
||||
}
|
||||
|
||||
+5
-5
@@ -14,13 +14,13 @@ class RenameTerminalSessionAction : ToolWindowTabRenameActionBase(
|
||||
TerminalToolWindowFactory.TOOL_WINDOW_ID,
|
||||
TerminalBundle.message("action.RenameSession.newSessionName.label")
|
||||
), DumbAware {
|
||||
override fun getContentDisplayNameToEdit(content: Content, project: Project): String =
|
||||
TerminalToolWindowManager.getWidgetByContent(content)?.terminalTitle?.let {
|
||||
it.userDefinedTitle ?: it.applicationTitle ?: it.defaultTitle
|
||||
} ?: content.displayName
|
||||
override fun getContentDisplayNameToEdit(content: Content, project: Project): String {
|
||||
val widget = TerminalToolWindowManager.findWidgetByContent(content) ?: return content.displayName
|
||||
return widget.terminalTitle.buildFullTitle()
|
||||
}
|
||||
|
||||
override fun applyContentDisplayName(content: Content, project: Project, @Nls newContentName: String) {
|
||||
TerminalToolWindowManager.getWidgetByContent(content)?.terminalTitle?.change {
|
||||
TerminalToolWindowManager.findWidgetByContent(content)?.terminalTitle?.change {
|
||||
userDefinedTitle = newContentName
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user