@Override
    protected void addEdits(IDocument document, TextEdit rootEdit) throws CoreException {
      try {
        String lineDelimiter = TextUtilities.getDefaultLineDelimiter(document);
        final IJavaProject project = getCompilationUnit().getJavaProject();
        IRegion region = document.getLineInformationOfOffset(fInsertPosition);

        String lineContent = document.get(region.getOffset(), region.getLength());
        String indentString = Strings.getIndentString(lineContent, project);
        String str = Strings.changeIndent(fComment, 0, project, indentString, lineDelimiter);
        InsertEdit edit = new InsertEdit(fInsertPosition, str);
        rootEdit.addChild(edit);
        if (fComment.charAt(fComment.length() - 1) != '\n') {
          rootEdit.addChild(new InsertEdit(fInsertPosition, lineDelimiter));
          rootEdit.addChild(new InsertEdit(fInsertPosition, indentString));
        }
      } catch (BadLocationException e) {
        throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
      }
    }