package com.intellij.diagnostic.errordialog;

public class Attachment {
  private final String myPath;
  private String myContent;
  private boolean myIncluded = true;

  public Attachment(String path, String content) {
    myPath = path;
    myContent = content;
  }

  public String getPath() {
    return myPath;
  }

  public String getContent() {
    return myContent;
  }

  public void setContent(String content) {
    myContent = content;
  }

  public boolean isIncluded() {
    return myIncluded;
  }

  public void setIncluded(Boolean included) {
    myIncluded = included;
  }
}

@@ -43,225 +43,932 @@
 g;%0A%0A
-public class Attachment %7B%0A  private final String myPath;%0A  private String myContent;%0A  private boolean myIncluded = true;%0A%0A  public Attachment(String path, String content) %7B%0A    myPath = path;%0A    myContent = content;
+import com.intellij.openapi.fileEditor.impl.LoadTextUtil;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.util.Base64Converter;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.io.IOException;%0A%0Apublic class Attachment %7B%0A  private final String myPath;%0A  private String myContent;%0A  private boolean myIncluded = true;%0A%0A  public Attachment(String path, String content) %7B%0A    myPath = path;%0A    myContent = content;%0A  %7D%0A%0A  public Attachment(@NotNull VirtualFile file) %7B%0A    this(file.getPresentableUrl(), loadText(file));%0A  %7D%0A%0A  private static String loadText(VirtualFile file) %7B%0A    if (file.getFileType().isBinary()) %7B%0A      try %7B%0A        return %22Binary file, base64 encoded: %22 + Base64Converter.encode(file.contentsToByteArray());%0A      %7D%0A      catch (IOException e) %7B%0A        return %22Cannot load binary file content%22;%0A      %7D%0A    %7D%0A    else %7B%0A      return LoadTextUtil.loadText(file).toString();%0A    %7D
 %0A  %7D

add another convenient Attachment constructor