String (@NotNull DiffContent content, @Nullable String title, @Nullable String windowTitle) { if (content instanceof EmptyContent) { return "no_content.tmp"; } String fileName = content.getUserData(DiffUserDataKeysEx.FILE_NAME); if (fileName == null && content instanceof DocumentContent) { VirtualFile highlightFile = ((DocumentContent)content).getHighlightFile(); fileName = highlightFile != null ? highlightFile.getName() : null; } if (fileName == null && content instanceof FileContent) { fileName = ((FileContent)content).getFile().getName(); } if (!StringUtil.isEmptyOrSpaces(fileName)) { return fileName; } FileType fileType = content.getContentType(); String ext = fileType != null ? fileType.getDefaultExtension() : null; if (StringUtil.isEmptyOrSpaces(ext)) ext = "tmp"; String name = ""; if (title != null && windowTitle != null) { name = title + "_" + windowTitle; } else if (title != null || windowTitle != null) { name = title != null ? title : windowTitle; } if (name.length() > 50) name = name.substring(0, 50); return PathUtil.suggestFileName(name + "." + ext, true, false); }