public void swipe(final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction,
                    final @Nullable Runnable onDone) {
    stopSwipeIfNeeded();
    mySwipeFrom = findVisible(parent);
    mySwipeTo = myMap.get(name);
    if (mySwipeTo == null) return;
    Application app = ApplicationManager.getApplication();
    if (mySwipeFrom == null || mySwipeFrom == mySwipeTo || (app != null && app.isUnitTestMode())) {
      super.show(parent, name);
      if (onDone != null) {
        onDone.run();
      }
      return;
    }
    final boolean isForward;
    if (direction == SwipeDirection.AUTO) {
      boolean b = true;
      for (Component component : myMap.values()) {
        if (component == mySwipeFrom || component == mySwipeTo) {
          b = component == mySwipeFrom;
          break;
        }
      }
      isForward = b;
    }
    else {
      isForward = direction == SwipeDirection.FORWARD;
    }
    final double[] linearProgress = new double[1];
    linearProgress[0] = 0;
    final long startTime = System.currentTimeMillis();
    ActionListener listener = new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        long timePassed = System.currentTimeMillis() - startTime;
        if (timePassed >= mySwipeTime) {
          Component currentFocusComponent = IdeFocusManager.getGlobalInstance().getFocusedDescendantFor(parent);
          show(parent, name);
          if (currentFocusComponent != null) currentFocusComponent.requestFocusInWindow();
          if (onDone != null) {
            onDone.run();
          }
          return;
        }
        linearProgress[0] = MathUtil.clamp((float)timePassed / mySwipeTime, 0, 1);
        double naturalProgress = (1 - Math.cos(Math.PI * linearProgress[0])) / 2;
        Rectangle bounds = new Rectangle(parent.getWidth(), parent.getHeight());
        JBInsets.removeFrom(bounds, parent.getInsets());
        Rectangle r = new Rectangle(bounds);
        int x = (int)((naturalProgress * r.width));
        r.translate(isForward ? -x : x, 0);
        mySwipeFrom.setBounds(r);
        Rectangle r2 = new Rectangle(bounds);
        r2.translate(isForward ? r2.width - x : x - r2.width, 0);
        mySwipeTo.setVisible(true);
        mySwipeTo.setBounds(r2);
        parent.repaint();
      }
    };
    for (ActionListener actionListener : myTimer.getActionListeners()) {
      myTimer.removeActionListener(actionListener);
    }
    myTimer.addActionListener(listener);
    myTimer.start();
  }
public void swipe(final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction,
                    final @Nullable Runnable onDone)