Skip to content

Commit

Permalink
(IJ-CR-102075) NewToolbarRootPaneExtension: extract the left/right AP…
Browse files Browse the repository at this point in the history
…Is to override them in Rider

Co-authored-by: Elena Korotkova <[email protected]>

GitOrigin-RevId: d8e9fe4bb89f29ec1bc9e7a3b78b996459bd8627
  • Loading branch information
ForNeVeR authored and intellij-monorepo-bot committed Feb 9, 2023
1 parent f240f48 commit 7562385
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl
import com.intellij.openapi.actionSystem.impl.segmentedActionBar.ToolbarActionsUpdatedListener
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.EDT
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
Expand Down Expand Up @@ -95,20 +94,20 @@ open class NewToolbarRootPaneManager(private val project: Project) : SimpleModif
}
}

open fun isLeftSideAction(action: AnAction): Boolean =
action.templateText.equals(ActionsBundle.message("group.LeftToolbarSideGroup.text"))

open fun isRightSideAction(action: AnAction): Boolean =
action.templateText.equals(ActionsBundle.message("group.RightToolbarSideGroup.text"))

@RequiresBackgroundThread
private fun correctedToolbarActions(): Map<String, ActionGroup?> {
val toolbarGroup = getToolbarGroup() ?: return emptyMap()

val children = toolbarGroup.getChildren(null)

val leftGroup = children.firstOrNull {
it.templateText.equals(ActionsBundle.message("group.LeftToolbarSideGroup.text")) || it.templateText.equals(
ActionsBundle.message("group.LeftToolbarSideGroupXamarin.text"))
}
val rightGroup = children.firstOrNull {
it.templateText.equals(ActionsBundle.message("group.RightToolbarSideGroup.text")) || it.templateText.equals(
ActionsBundle.message("group.RightToolbarSideGroupXamarin.text"))
}
val leftGroup = children.firstOrNull(::isLeftSideAction)
val rightGroup = children.firstOrNull(::isRightSideAction)
val restGroup = DefaultActionGroup(children.filter { it != leftGroup && it != rightGroup })

val map = mutableMapOf<String, ActionGroup?>()
Expand Down

0 comments on commit 7562385

Please sign in to comment.