mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
Setup project view toolwindow actions during initialization, fix IDEA-312339
GitOrigin-RevId: 62e0d4ea787dfefad649c176d015461e0bd974e0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bd87bfdaf2
commit
4a220a70b5
@@ -938,6 +938,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
|
||||
}
|
||||
});
|
||||
viewSelectionChanged();
|
||||
setupToolwindowActions(toolWindow);
|
||||
|
||||
Object multicaster = EditorFactory.getInstance().getEventMulticaster();
|
||||
if (multicaster instanceof EditorEventMulticasterEx ex) {
|
||||
@@ -971,6 +972,20 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
|
||||
}
|
||||
}
|
||||
|
||||
private void setupToolwindowActions(@NotNull ToolWindow toolWindow) {
|
||||
List<AnAction> titleActions = new ArrayList<>();
|
||||
createTitleActions(titleActions);
|
||||
if (!titleActions.isEmpty()) {
|
||||
toolWindow.setTitleActions(titleActions);
|
||||
}
|
||||
|
||||
List<AnAction> tabActions = new ArrayList<>();
|
||||
createTabActions(tabActions);
|
||||
if (!tabActions.isEmpty()) {
|
||||
((ToolWindowEx)toolWindow).setTabActions(tabActions.toArray(AnAction[]::new));
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void reloadPanes() {
|
||||
if (myProject.isDisposed() || !myExtensionsLoaded.get()) return; // panes will be loaded later
|
||||
|
||||
@@ -1061,24 +1076,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
|
||||
}
|
||||
|
||||
pane.addToolbarActions(myActionGroup);
|
||||
|
||||
List<AnAction> titleActions = new ArrayList<>();
|
||||
createTitleActions(titleActions);
|
||||
if (!titleActions.isEmpty()) {
|
||||
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.PROJECT_VIEW);
|
||||
if (window != null) {
|
||||
window.setTitleActions(titleActions);
|
||||
}
|
||||
}
|
||||
|
||||
List<AnAction> tabActions = new ArrayList<>();
|
||||
createTabActions(tabActions);
|
||||
if (!tabActions.isEmpty()) {
|
||||
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.PROJECT_VIEW);
|
||||
if (window instanceof ToolWindowEx) {
|
||||
((ToolWindowEx)window).setTabActions(tabActions.toArray(AnAction[]::new));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void createTitleActions(@NotNull List<? super AnAction> titleActions) {
|
||||
|
||||
Reference in New Issue
Block a user