mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-233558 hide structure window
GitOrigin-RevId: cb41f8014f9119580bb033e4040fd16c4a08fd51
This commit is contained in:
committed by
intellij-monorepo-bot
parent
750518a941
commit
4c2f36606e
@@ -3,9 +3,9 @@ package com.intellij.agent.workbench.sessions
|
||||
|
||||
import com.intellij.openapi.components.SerializablePersistentStateComponent
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.SettingsCategory
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
import com.intellij.openapi.components.StoragePathMacros
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@@ -107,7 +107,7 @@ internal class InMemorySessionsTreeUiState : SessionsTreeUiState {
|
||||
}
|
||||
|
||||
@Service(Service.Level.APP)
|
||||
@State(name = "CodexSessionsTreeUiState", storages = [Storage("other.xml")], category = SettingsCategory.TOOLS)
|
||||
@State(name = "CodexSessionsTreeUiState", storages = [Storage(StoragePathMacros.CACHE_FILE)])
|
||||
internal class AgentSessionsTreeUiStateService
|
||||
: SerializablePersistentStateComponent<AgentSessionsTreeUiStateService.SessionsTreeUiStateState>(SessionsTreeUiStateState()),
|
||||
SessionsTreeUiState {
|
||||
|
||||
@@ -3,4 +3,5 @@ package com.intellij.agent.workbench.sessions
|
||||
|
||||
internal const val AGENT_SESSIONS_TOOL_WINDOW_ID: String = "agent.workbench.sessions"
|
||||
internal const val AGENT_WORKBENCH_DEDICATED_LAYOUT_PROFILE_ID: String = "agent.workbench.dedicated"
|
||||
internal const val AGENT_WORKBENCH_LAYOUT_MIGRATION_VERSION: Int = 1
|
||||
internal const val TERMINAL_TOOL_WINDOW_ID: String = "Terminal"
|
||||
internal const val AGENT_WORKBENCH_LAYOUT_MIGRATION_VERSION: Int = 2
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package com.intellij.agent.workbench.sessions
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.openapi.wm.ex.ProjectFrameCapabilitiesProvider
|
||||
import com.intellij.openapi.wm.ex.ProjectFrameCapability
|
||||
import com.intellij.openapi.wm.ex.ProjectFrameUiPolicy
|
||||
@@ -41,6 +40,5 @@ private val AGENT_WORKBENCH_FRAME_CAPABILITIES = EnumSet.of(
|
||||
|
||||
private val AGENT_WORKBENCH_FRAME_UI_POLICY = ProjectFrameUiPolicy(
|
||||
startupToolWindowIdToActivate = AGENT_SESSIONS_TOOL_WINDOW_ID,
|
||||
toolWindowIdsToHideOnStartup = setOf(ToolWindowId.PROJECT_VIEW),
|
||||
toolWindowLayoutProfileId = AGENT_WORKBENCH_DEDICATED_LAYOUT_PROFILE_ID,
|
||||
)
|
||||
|
||||
+18
-1
@@ -25,7 +25,7 @@ internal class AgentWorkbenchToolWindowLayoutProfileProvider : ToolWindowLayoutP
|
||||
val baseLayout = ToolWindowDefaultLayoutManager.getInstance().getLayoutCopy()
|
||||
val infos = baseLayout.getInfos()
|
||||
.asSequence()
|
||||
.filter { (id, _) -> id != ToolWindowId.PROJECT_VIEW }
|
||||
.filterNot { (id, _) -> id == ToolWindowId.PROJECT_VIEW || id == ToolWindowId.STRUCTURE_VIEW }
|
||||
.associateTo(LinkedHashMap()) { (id, info) -> id to info.copy() }
|
||||
|
||||
val sessionsInfo = infos.get(AGENT_SESSIONS_TOOL_WINDOW_ID) ?: WindowInfoImpl()
|
||||
@@ -43,6 +43,23 @@ internal class AgentWorkbenchToolWindowLayoutProfileProvider : ToolWindowLayoutP
|
||||
sessionsInfo.weight = 0.25f
|
||||
infos.put(AGENT_SESSIONS_TOOL_WINDOW_ID, sessionsInfo)
|
||||
|
||||
val nextOrderOnBottom = infos.values.asSequence()
|
||||
.filter { it.toolWindowPaneId == paneId && it.anchor == ToolWindowAnchor.BOTTOM && it.order >= 0 }
|
||||
.maxOfOrNull { it.order + 1 } ?: 0
|
||||
val terminalInfo = infos.get(TERMINAL_TOOL_WINDOW_ID) ?: WindowInfoImpl()
|
||||
val needsBottomPlacement = terminalInfo.toolWindowPaneId != paneId ||
|
||||
terminalInfo.anchor != ToolWindowAnchor.BOTTOM ||
|
||||
terminalInfo.order < 0
|
||||
terminalInfo.id = TERMINAL_TOOL_WINDOW_ID
|
||||
terminalInfo.toolWindowPaneId = paneId
|
||||
terminalInfo.anchor = ToolWindowAnchor.BOTTOM
|
||||
if (needsBottomPlacement) {
|
||||
terminalInfo.order = nextOrderOnBottom
|
||||
}
|
||||
terminalInfo.isVisible = false
|
||||
terminalInfo.isShowStripeButton = true
|
||||
infos.put(TERMINAL_TOOL_WINDOW_ID, terminalInfo)
|
||||
|
||||
return DesktopLayout(infos, baseLayout.unifiedWeights.copy())
|
||||
}
|
||||
|
||||
|
||||
+24
@@ -2,12 +2,19 @@
|
||||
package com.intellij.agent.workbench.sessions
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor
|
||||
import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.testFramework.ApplicationRule
|
||||
import com.intellij.toolWindow.ToolWindowLayoutApplyMode
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import java.lang.reflect.Proxy
|
||||
|
||||
class AgentWorkbenchToolWindowLayoutProfileProviderTest {
|
||||
@get:Rule
|
||||
val applicationRule = ApplicationRule()
|
||||
|
||||
private val provider = AgentWorkbenchToolWindowLayoutProfileProvider()
|
||||
|
||||
@Test
|
||||
@@ -20,6 +27,23 @@ class AgentWorkbenchToolWindowLayoutProfileProviderTest {
|
||||
.isEqualTo(AGENT_WORKBENCH_LAYOUT_MIGRATION_VERSION)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dedicatedLayoutHidesStructureAndKeepsTerminalInStripeWithoutOpeningIt() {
|
||||
val project = testProject()
|
||||
|
||||
val layout = provider.getLayout(project, AGENT_WORKBENCH_DEDICATED_LAYOUT_PROFILE_ID, isNewUi = true)
|
||||
|
||||
assertThat(layout).isNotNull
|
||||
assertThat(layout!!.getInfo(ToolWindowId.PROJECT_VIEW)).isNull()
|
||||
assertThat(layout.getInfo(ToolWindowId.STRUCTURE_VIEW)).isNull()
|
||||
|
||||
val terminalInfo = layout.getInfo(TERMINAL_TOOL_WINDOW_ID)
|
||||
assertThat(terminalInfo).isNotNull
|
||||
assertThat(terminalInfo!!.anchor).isEqualTo(ToolWindowAnchor.BOTTOM)
|
||||
assertThat(terminalInfo.isShowStripeButton).isTrue()
|
||||
assertThat(terminalInfo.isVisible).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun nonDedicatedProfileKeepsSeedOnlyPolicy() {
|
||||
val project = testProject()
|
||||
|
||||
Reference in New Issue
Block a user