private void removeTab(@NotNull Content content, String displayName) {
    //        Component[] comps = (content.getComponent()).getComponents();
    //        JTabbedPane tabbedPane = (JTabbedPane) comps[1];
    JTabbedPane tabbedPane = getTabComponent(content);
    int index = tabbedPane.indexOfTab(displayName);
    if (index == -1) {
      return;
    }

    tabbedPane.remove(index);
  }
  private QueryStatisticsPanel addDMLStatsTab(
      @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String s) {
    //        Component[] comps = (content.getComponent()).getComponents();
    //        JTabbedPane tabbedPane = (JTabbedPane) comps[1];
    JTabbedPane tabbedPane = getTabComponent(content);
    QueryStatisticsPanel dmlStatsPanel = new QueryStatisticsPanel();
    dmlStatsPanel.putClientProperty(CREATE_TIME, new Date().getTime());

    tabbedPane.addTab(sqlMarker.getName(), dmlStatsPanel);
    int index = tabbedPane.indexOfTab(sqlMarker.getName());
    tabbedPane.setTabComponentAt(index, new ButtonTabComponent(tabbedPane, icon, sqlMarker));

    return dmlStatsPanel;
  }
  private DataGridPanel addGridPanelTab(
      @NotNull Content content, SqlStatementMarker sqlMarker, Icon icon, String toolTip) {
    JTabbedPane tabbedPane = getTabComponent(content);
    DataGridPanel dataGridPanel = new DataGridPanel();
    dataGridPanel.putClientProperty(CREATE_TIME, new Date().getTime());

    tabbedPane.addTab(sqlMarker.getName(), dataGridPanel);
    int index = tabbedPane.indexOfTab(sqlMarker.getName());
    ButtonTabComponent buttonTab = new ButtonTabComponent(tabbedPane, icon, sqlMarker);
    if (toolTip != null) {
      buttonTab.setToolTipText(toolTip);
    }
    tabbedPane.setTabComponentAt(index, buttonTab);
    return dataGridPanel;
  }
  /**
   * Set the requested content "selected" and show ToolWindow if it hided
   *
   * @param displayName
   * @param wait
   */
  public void showContent(String displayName, final int wait) {
    //        Project project =
    // DataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow wm = toolWindowManager.getToolWindow(QUERY_RESULT_PANE);

    if (wm == null) {
      wm = toolWindowManager.registerToolWindow(QUERY_RESULT_PANE, true, ToolWindowAnchor.BOTTOM);
      wm.setIcon(Icons.QUERY_RESULT_PANE);
      wm.setToHideOnEmptyContent(true);
    }

    String contentName = connectionManager.getDbUrl().getUserHostPortServiceName().toLowerCase();
    Content content = wm.getContentManager().findContent(contentName);

    if (content == null) {
      return;
    }

    wm.getContentManager().setSelectedContent(content);
    JTabbedPane tabbedPane = getTabComponent(content);
    int index = tabbedPane.indexOfTab(displayName);
    if (index == -1) {
      return;
    }

    tabbedPane.requestFocusInWindow();
    tabbedPane.setSelectedIndex(index);

    if (!wm.isVisible()) {
      wm.activate(
          new Runnable() {
            public void run() {
              try {
                Thread.sleep(wait);
              } catch (InterruptedException e1) {
              }
            }
            //            }, false);
          },
          true);
    }
  }
  private synchronized void doShowSalesReport() {

    BackOfficeWindow window = BackOfficeWindow.getInstance();
    JTabbedPane tabbedPane = window.getTabbedPane();

    ReportViewer viewer = null;
    //        int index = tabbedPane.indexOfTab(com.floreantpos.POSConstants.SALES_REPORT);
    int index = tabbedPane.indexOfTab("Transaksi Harian");
    if (index == -1) {
      //            viewer = new ReportViewer(new SalesReport());
      viewer = new ReportViewer(new DailyTxnReport());
      //            tabbedPane.addTab(POSConstants.SALES_REPORT, viewer);
      tabbedPane.addTab("Transaksi Harian", viewer);
    } else {
      viewer = (ReportViewer) tabbedPane.getComponentAt(index);
    }
    tabbedPane.setSelectedComponent(viewer);

    window.setVisible(true);
  }