diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java index 02449b4a3084..c40aa1de01fb 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.packageDependencies.ui; import com.intellij.CommonBundle; @@ -133,7 +133,10 @@ public final class DependenciesPanel extends JPanel implements Disposable, DataP splitter.setFirstComponent(treeSplitter); splitter.setSecondComponent(myUsagesPanel); add(splitter, BorderLayout.CENTER); - add(createToolbar(), BorderLayout.NORTH); + + ActionToolbar toolbar = createToolbar(); + toolbar.setTargetComponent(treeSplitter); + add(toolbar.getComponent(), BorderLayout.NORTH); myRightTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myRightTree, myProject); myLeftTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myLeftTree, myProject); @@ -277,7 +280,7 @@ public final class DependenciesPanel extends JPanel implements Disposable, DataP } } - private JComponent createToolbar() { + private @NotNull ActionToolbar createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new CloseAction()); group.add(new RerunAction(this)); @@ -298,8 +301,7 @@ public final class DependenciesPanel extends JPanel implements Disposable, DataP group.add(new EditDependencyRulesAction()); group.add(CommonActionsManager.getInstance().createExportToTextFileAction(new DependenciesExporterToTextFile())); - ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("PackageDependencies", group, true); - return toolbar.getComponent(); + return ActionManager.getInstance().createActionToolbar("PackageDependencies", group, true); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/UsagesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/UsagesPanel.java index bde3f90c1e7c..c3e4ae947768 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/UsagesPanel.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/UsagesPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.packageDependencies.ui; import com.intellij.codeInsight.CodeInsightBundle; @@ -15,6 +15,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.psi.PsiElement; import com.intellij.usageView.UsageInfo; import com.intellij.usages.*; +import com.intellij.usages.impl.UsageViewImpl; import com.intellij.util.Alarm; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; @@ -61,6 +62,7 @@ public abstract class UsagesPanel extends JPanel implements Disposable, DataProv UsageViewPresentation presentation = new UsageViewPresentation(); presentation.setCodeUsagesString(getCodeUsagesString()); myCurrentUsageView = UsageViewManager.getInstance(myProject).createUsageView(UsageTarget.EMPTY_ARRAY, usages, presentation, null); + ((UsageViewImpl)myCurrentUsageView).expandRoot(); setToComponent(myCurrentUsageView.getComponent()); } catch (ProcessCanceledException e) {