mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IJPL-174330 T: [MyNavBarWrapperPanel.runToolbarExists]
(cherry picked from commit 629a60c16c4524d8a931f929d1f80c42f20c7254) IJ-CR-161755 GitOrigin-RevId: 1046a30750df725874fd142aa7dd0a20ba79c473
This commit is contained in:
committed by
intellij-monorepo-bot
parent
84070aa2ec
commit
00164edaee
@@ -195,13 +195,12 @@ internal class MyNavBarWrapperPanel(private val project: Project, useAsComponent
|
||||
//return !UISettings.getInstance().showMainToolbar && runToolbarExists();
|
||||
}
|
||||
|
||||
private fun runToolbarExists(): Boolean {
|
||||
if (navToolbarGroupExist == null) {
|
||||
val correctedAction = CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_NAVBAR_TOOLBAR)
|
||||
navToolbarGroupExist = correctedAction is DefaultActionGroup && correctedAction.childrenCount > 0 ||
|
||||
correctedAction is CustomisedActionGroup && correctedAction.getFirstAction() != null
|
||||
}
|
||||
return navToolbarGroupExist!!
|
||||
private fun runToolbarExists(): Boolean = navToolbarGroupExist ?: run {
|
||||
when (val o = CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_NAVBAR_TOOLBAR)) {
|
||||
is DefaultActionGroup -> o.childrenCount > 0
|
||||
is CustomisedActionGroup -> o.defaultChildrenOrStubs.size > 0
|
||||
else -> false
|
||||
}.also { navToolbarGroupExist = it }
|
||||
}
|
||||
|
||||
private fun toggleNavPanel(settings: UISettings) {
|
||||
@@ -315,15 +314,13 @@ private fun isNeedGap(group: AnAction): Boolean {
|
||||
}
|
||||
|
||||
private fun getFirstAction(group: AnAction): AnAction? {
|
||||
if (group is CustomisedActionGroup) {
|
||||
return group.getFirstAction()
|
||||
val actionsOrStubs = when (group) {
|
||||
is DefaultActionGroup -> group.childActionsOrStubs
|
||||
is CustomisedActionGroup -> group.defaultChildrenOrStubs
|
||||
else -> AnAction.EMPTY_ARRAY
|
||||
}
|
||||
else if (group !is DefaultActionGroup) {
|
||||
return null
|
||||
}
|
||||
|
||||
var firstAction: AnAction? = null
|
||||
for (action in group.getChildActionsOrStubs()) {
|
||||
for (action in actionsOrStubs) {
|
||||
if (action is DefaultActionGroup) {
|
||||
firstAction = getFirstAction(action)
|
||||
}
|
||||
|
||||
@@ -4357,7 +4357,6 @@ f:com.intellij.ide.ui.customization.CustomisedActionGroup
|
||||
- <init>(java.lang.String,com.intellij.openapi.actionSystem.ActionGroup,com.intellij.ide.ui.customization.CustomActionsSchema,java.lang.String,java.lang.String):V
|
||||
- equals(java.lang.Object):Z
|
||||
- getChildren(com.intellij.openapi.actionSystem.AnActionEvent):com.intellij.openapi.actionSystem.AnAction[]
|
||||
- getFirstAction():com.intellij.openapi.actionSystem.AnAction
|
||||
- getOrigin():com.intellij.openapi.actionSystem.ActionGroup
|
||||
- hashCode():I
|
||||
- resetChildren():V
|
||||
|
||||
@@ -60,11 +60,6 @@ public final class CustomisedActionGroup extends ActionGroupWrapper {
|
||||
delegate, g.getChildActionsOrStubs(), mySchema, myDefaultGroupName, myRootGroupName);
|
||||
}
|
||||
|
||||
public @Nullable AnAction getFirstAction() {
|
||||
AnAction[] children = getChildren(null);
|
||||
return children.length > 0 ? children[0] : null;
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #getDelegate()} instead */
|
||||
@Deprecated(forRemoval = true)
|
||||
public @NotNull ActionGroup getOrigin() { return getDelegate(); }
|
||||
|
||||
Reference in New Issue
Block a user