<commit_before>package com.jetbrains.crucible.ui;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.ui.awt.RelativePoint;
import com.jetbrains.crucible.model.Comment;
import org.jetbrains.annotations.NotNull;

import java.awt.*;

/**
 * User: ktisha
 */
public class ReviewBalloonBuilder {

  public ReviewBalloonBuilder() {
  }

  public void showBalloon(@NotNull final Comment comment, @NotNull final Editor editor,
                          final ReviewForm balloonContent, final String title) {

    final Document document = editor.getDocument();
    final int endOffset = document.getLineEndOffset(Integer.parseInt(comment.getLine()));

    final BalloonBuilder balloonBuilder =
      JBPopupFactory.getInstance().createDialogBalloonBuilder(balloonContent, title);
    balloonBuilder.setHideOnClickOutside(true);
    balloonBuilder.setHideOnKeyOutside(true);
    Balloon balloon = balloonBuilder.createBalloon();

    final Point targetPoint = editor.visualPositionToXY(editor.offsetToVisualPosition(endOffset));
    balloon.show(new RelativePoint(editor.getContentComponent(), targetPoint), Balloon.Position.below);
  }
}
<commit_msg>fixed #2 resizable comment popup usability problem<commit_after>package com.jetbrains.crucible.ui;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.popup.*;
import com.intellij.ui.awt.RelativePoint;
import com.jetbrains.crucible.model.Comment;
import org.jetbrains.annotations.NotNull;

import java.awt.*;

/**
 * User: ktisha
 */
public class ReviewBalloonBuilder {

  public ReviewBalloonBuilder() {
  }

  public void showBalloon(@NotNull final Comment comment, @NotNull final Editor editor,
                          final ReviewForm balloonContent, final String title) {

    final Document document = editor.getDocument();
    final int endOffset = document.getLineEndOffset(Integer.parseInt(comment.getLine()));

    ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(balloonContent, balloonContent);
    builder.setResizable(true);
    builder.setTitle(title);
    builder.setMovable(true);
    final JBPopup popup = builder.createPopup();
    final Point targetPoint = editor.visualPositionToXY(editor.offsetToVisualPosition(endOffset));
    popup.show(new RelativePoint(editor.getContentComponent(), targetPoint));
  }
}

{'fraction_non_alphanumeric': 0.09992283950617284, 'fraction_numerical': 0.00038580246913580245, 'mean_word_length': 5.016241299303944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3518362', 'n_tokens_mistral': 773, 'n_tokens_neox': 724, 'n_words': 140}