Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Fix toolkit connection dropdown getting hidden when panel width is small."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package software.aws.toolkits.jetbrains.core.explorer

import com.intellij.openapi.actionSystem.ActionToolbar
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.util.ui.components.BorderLayoutPanel

object ConnectionActionToolbarBuilder {
fun createToolbar(toolWindow: AwsToolkitExplorerToolWindow, group: DefaultActionGroup): BorderLayoutPanel {
return BorderLayoutPanel().apply {
addToCenter(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, group, true).apply {
layoutPolicy = ActionToolbar.NOWRAP_LAYOUT_POLICY
setTargetComponent(toolWindow)
}.component
)

val actionManager = ActionManager.getInstance()
val rightActionGroup = DefaultActionGroup(
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.more"),
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.help")
)

addToRight(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, rightActionGroup, true).apply {
setTargetComponent(toolWindow.component)
}.component
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package software.aws.toolkits.jetbrains.core.explorer

import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.ActionToolbar
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.actionSystem.toolbarLayout.ToolbarLayoutStrategy
import com.intellij.util.ui.components.BorderLayoutPanel

object ConnectionActionToolbarBuilder {
fun createToolbar(toolWindow: AwsToolkitExplorerToolWindow, group: DefaultActionGroup): BorderLayoutPanel {
return BorderLayoutPanel().apply {
addToCenter(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, group, true).apply {
layoutStrategy = ToolbarLayoutStrategy.NOWRAP_STRATEGY
setTargetComponent(toolWindow)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since only this section differs across the versions, can we move the creation of this component to the util file and retain the creation for the panel in the init block of AWSToolkitExplorerToolWindow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done & done, Thanks for the feedback :)

}.component
)

val actionManager = ActionManager.getInstance()
val rightActionGroup = DefaultActionGroup(
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.more"),
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.help")
)

addToRight(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, rightActionGroup, true).apply {
setTargetComponent(toolWindow.component)
}.component
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.ui.components.JBTabbedPane
import com.intellij.util.ui.components.BorderLayoutPanel
import software.aws.toolkits.jetbrains.core.credentials.CredsComboBoxActionGroup
import software.aws.toolkits.jetbrains.core.explorer.ConnectionActionToolbarBuilder
import software.aws.toolkits.jetbrains.core.explorer.cwqTab.CodewhispererQToolWindow
import software.aws.toolkits.jetbrains.core.explorer.cwqTab.isQInstalled
import software.aws.toolkits.jetbrains.core.explorer.devToolsTab.DevToolsToolWindow
Expand Down Expand Up @@ -64,27 +65,7 @@ class AwsToolkitExplorerToolWindow(
setContent(content)
val group = CredsComboBoxActionGroup(project)

toolbar = BorderLayoutPanel().apply {
addToCenter(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, group, true).apply {
layoutPolicy = ActionToolbar.AUTO_LAYOUT_POLICY
setTargetComponent(this@AwsToolkitExplorerToolWindow)
}.component
)

val actionManager = ActionManager.getInstance()
val rightActionGroup = DefaultActionGroup(
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.more"),
actionManager.getAction("aws.toolkit.toolwindow.credentials.rightGroup.help")
)

addToRight(
ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, rightActionGroup, true).apply {
// revisit if these actions need the tool window as a data provider
setTargetComponent(component)
}.component
)
}
toolbar = ConnectionActionToolbarBuilder.createToolbar(this,group)

// main content
tabComponents.forEach { name, contentProvider ->
Expand Down
Loading