Skip to content

Commit ae59b16

Browse files
committed
fix(mcp): adjust tool detail panel layout and styling #371
Simplify UI by removing server name from title, changing description to JTextPane, and adjusting spacing. Improves readability and consistency with other panels.
1 parent fbb6993 commit ae59b16

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/editor/McpToolDetailPanel.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class McpToolDetailPanel(
2525
private val project: Project,
2626
private val serverName: String,
2727
private val tool: Tool
28-
) : JPanel(BorderLayout(0, 8)) {
28+
) : JPanel(BorderLayout(0, 0)) {
2929
private val mcpServerManager = CustomMcpServerManager.instance(project)
3030
private val borderColor = JBColor(0xE5E7EB, 0x3C3F41)
3131
private val textGray = JBColor(0x6B7280, 0x9DA0A8)
@@ -42,11 +42,11 @@ class McpToolDetailPanel(
4242
border = CompoundBorder(BorderFactory.createLineBorder(borderColor), JBUI.Borders.empty(4))
4343
preferredSize = Dimension(TOOL_CARD_WIDTH, MAX_TOOL_CARD_HEIGHT)
4444

45-
val headerPanel = JPanel(BorderLayout(8, 4)).apply {
45+
val headerPanel = JPanel(BorderLayout(4, 4)).apply {
4646
background = UIUtil.getPanelBackground()
4747
}
4848

49-
val titleLabel = JBLabel(serverName + ":" + tool.name).apply {
49+
val titleLabel = JBLabel(tool.name).apply {
5050
font = JBUI.Fonts.label(14.0f).asBold()
5151
}
5252

@@ -56,9 +56,13 @@ class McpToolDetailPanel(
5656
}
5757

5858
val descriptionText = tool.description ?: "No description available"
59-
val descLabel = JBLabel(descriptionText).apply {
59+
val descLabel = JTextPane().apply {
60+
text = descriptionText
6061
font = JBUI.Fonts.label(12.0f)
6162
foreground = textGray
63+
isEditable = false
64+
background = null
65+
border = null
6266
}
6367

6468
headerPanel.add(titleWrapper, BorderLayout.NORTH)
@@ -69,7 +73,6 @@ class McpToolDetailPanel(
6973
}
7074

7175
val detailsButton = JButton("Details").apply {
72-
font = JBUI.Fonts.label(14.0f)
7376
isFocusPainted = false
7477
addActionListener { showToolDetails() }
7578
}
@@ -80,8 +83,6 @@ class McpToolDetailPanel(
8083
add(footerPanel, BorderLayout.SOUTH)
8184
}
8285

83-
private val json = Json { prettyPrint = true }
84-
8586
private fun showToolDetails() {
8687
val dialog = McpToolDetailDialog(project, serverName, tool, mcpServerManager)
8788
dialog.show()

0 commit comments

Comments
 (0)