void (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project == null || project.isDisposed()) { e.getPresentation().setEnabledAndVisible(false); return; } ToolWindow toolWindow = e.getData(PlatformDataKeys.TOOL_WINDOW); if (!(toolWindow instanceof ToolWindowImpl)) { e.getPresentation().setEnabledAndVisible(false); return; } Icon icon = ExperimentalUI.isNewUI() ? AllIcons.General.OpenInToolWindow : ToolWindowMoveAction.Anchor.fromWindowInfo(((ToolWindowImpl)toolWindow).getWindowInfo()).getIcon(); e.getPresentation().setIcon(icon); e.getPresentation() .setEnabledAndVisible(toolWindow.getType() == ToolWindowType.FLOATING || toolWindow.getType() == ToolWindowType.WINDOWED); }