use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class MaximizeToolWindowAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null || project.isDisposed())
return;
ToolWindow toolWindow = e.getData(PlatformDataKeys.TOOL_WINDOW);
if (toolWindow == null)
return;
ToolWindowManager manager = ToolWindowManager.getInstance(project);
manager.setMaximized(toolWindow, !manager.isMaximized(toolWindow));
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class MaximizeToolWindowAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(true);
Project project = e.getProject();
if (project == null || project.isDisposed()) {
e.getPresentation().setEnabled(false);
return;
}
ToolWindow toolWindow = e.getData(PlatformDataKeys.TOOL_WINDOW);
if (toolWindow == null) {
e.getPresentation().setEnabled(false);
return;
}
ToolWindowManager manager = ToolWindowManager.getInstance(project);
e.getPresentation().setText(manager.isMaximized(toolWindow) ? ActionsBundle.message("action.ResizeToolWindowMaximize.text.alternative") : ActionsBundle.message("action.ResizeToolWindowMaximize.text"));
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class AbstractProjectViewPane method doSelectModuleOrGroup.
private void doSelectModuleOrGroup(final Object toSelect, final boolean requestFocus) {
ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
final Runnable runnable = () -> {
ProjectView projectView = ProjectView.getInstance(myProject);
if (requestFocus) {
projectView.changeView(getId(), getSubId());
}
((BaseProjectTreeBuilder) getTreeBuilder()).selectInWidth(toSelect, requestFocus, node -> node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode);
};
if (requestFocus) {
windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
} else {
runnable.run();
}
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class RunContentManagerImpl method init.
// must be called on EDT
private void init() {
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(myProject);
if (toolWindowManager == null) {
return;
}
for (Executor executor : ExecutorRegistry.getInstance().getRegisteredExecutors()) {
registerToolWindow(executor, toolWindowManager);
}
RunDashboardManager dashboardManager = RunDashboardManager.getInstance(myProject);
initToolWindow(null, dashboardManager.getToolWindowId(), dashboardManager.getToolWindowIcon(), dashboardManager.getDashboardContentManager());
toolWindowManager.addToolWindowManagerListener(new ToolWindowManagerAdapter() {
@Override
public void stateChanged() {
if (myProject.isDisposed()) {
return;
}
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
Set<String> currentWindows = new THashSet<>();
ContainerUtil.addAll(currentWindows, toolWindowManager.getToolWindowIds());
myToolwindowIdZBuffer.retainAll(currentWindows);
final String activeToolWindowId = toolWindowManager.getActiveToolWindowId();
if (activeToolWindowId != null) {
if (myToolwindowIdZBuffer.remove(activeToolWindowId)) {
myToolwindowIdZBuffer.addFirst(activeToolWindowId);
}
}
}
});
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class FavoritesViewSelectInTarget method select.
private static ActionCallback select(@NotNull Project project, Object toSelect, VirtualFile virtualFile, boolean requestFocus) {
final ActionCallback result = new ActionCallback();
ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
final ToolWindow favoritesToolWindow = windowManager.getToolWindow(ToolWindowId.FAVORITES_VIEW);
if (favoritesToolWindow != null) {
final Runnable runnable = () -> {
final FavoritesTreeViewPanel panel = UIUtil.findComponentOfType(favoritesToolWindow.getComponent(), FavoritesTreeViewPanel.class);
if (panel != null) {
panel.selectElement(toSelect, virtualFile, requestFocus);
result.setDone();
}
};
if (requestFocus) {
favoritesToolWindow.activate(runnable, false);
} else {
favoritesToolWindow.show(runnable);
}
}
return result;
}
Aggregations