Search in sources :

Example 1 with MergeRequest

use of com.intellij.openapi.diff.MergeRequest in project intellij-community by JetBrains.

the class ExternalToolContentExternalizer method getContentFile.

public File getContentFile() throws IOException {
    String extension = chooseExtension();
    String name = chooseName();
    if (name.length() <= 3)
        name = "___" + name;
    File tempFile;
    try {
        tempFile = FileUtil.createTempFile(name, extension);
    } catch (IOException e) {
        tempFile = FileUtil.createTempFile(STD_PREFIX, extension);
    }
    final DiffContent content = getContent();
    byte[] bytes = myRequest instanceof MergeRequest ? content.getDocument().getText().getBytes() : content.getBytes();
    FileUtil.writeToFile(tempFile, bytes);
    return tempFile;
}
Also used : MergeRequest(com.intellij.openapi.diff.MergeRequest) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) DiffContent(com.intellij.openapi.diff.DiffContent)

Aggregations

DiffContent (com.intellij.openapi.diff.DiffContent)1 MergeRequest (com.intellij.openapi.diff.MergeRequest)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 IOException (java.io.IOException)1