private static @Nullable TabsInfo getTabsInfo(IdeFrame @NotNull [] helpers, @NotNull IdeFrameImpl window) {
    int allLength = helpers.length;
    if (allLength < 2) {
      return null;
    }

    ID tabs = Foundation.invoke(MacUtil.getWindowFromJavaWindow(window), "tabbedWindows");
    int length = Foundation.invoke(tabs, "count").intValue();
    if (length < 2) {
      return null; // no tabs
    }

    if (allLength < length) {
      return null; // early state
    }

    Map<IdeFrameImpl, ProjectFrameHelper> helpersMap = new HashMap<>();
    ID[] allWindows = new ID[allLength];
    IdeFrameImpl[] allFrames = new IdeFrameImpl[allLength];

    for (int i = 0; i < allLength; i++) {
      ProjectFrameHelper helper = (ProjectFrameHelper)helpers[i];
      IdeFrameImpl frame = helper.getFrame();
      helpersMap.put(frame, helper);
      allFrames[i] = frame;
      allWindows[i] = MacUtil.getWindowFromJavaWindow(frame);
    }

    IdeFrameImpl[] frames = new IdeFrameImpl[length];

    for (int i = 0, founded = 0; i < allLength && founded < length; i++) {
      int index = Foundation.invoke(tabs, "indexOfObject:", allWindows[i]).intValue();
      if (index != -1) {
        frames[index] = allFrames[i];
        founded++;
      }
    }

    return new TabsInfo(frames, helpersMap);
  }
private static @Nullable TabsInfo getTabsInfo(IdeFrame @NotNull [] helpers, @NotNull IdeFrameImpl window)