@Override
  public void setSelected(@NotNull AnActionEvent event, boolean flag) {
    Project project = event.getProject();
    if (project == null) {
      return;
    }
    String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
    if (id == null) {
      return;
    }
    ToolWindowEx toolWindow = (ToolWindowEx)ToolWindowManager.getInstance(project).getToolWindow(id);
    ToolWindowType type = toolWindow.getType();
    if (ToolWindowType.WINDOWED == type) {
      toolWindow.setType(toolWindow.getInternalType(), null);
    }
    else {
      toolWindow.setType(ToolWindowType.WINDOWED, null);
    }
  }
@Override
  public void setSelected(@NotNull AnActionEvent event, boolean flag)