Skip to main content
diff options
authorThomas Wolf2018-07-05 16:53:00 -0400
committerThomas Wolf2018-07-07 06:55:56 -0400
commitb5764723c1bef281a3d7d00d6f64af1d016472ca (patch)
treebac154a75282563838785d579cf592957608fa6a /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/
parent96d430a13d0e9210ccf563d42ba94c202d578d18 (diff)
Better default editor opening for file revisions
EGit tried already to open the configured editor based on content types or file name associations. On failure, it would fall back to the default internal text editor. Unfortunately, opening a default editor failed always for editors that do require some physical file. Thus opening an external editor always failed, and EGit showed the file as text. Even if the file was binary. Newly, make FileRevisionEditorInput implement IPathEditorInput. Eclipse uses this to invoke external editors, so when getPath() is called, we can write the blob to a temporary file, so that the external editor has something to read from. This is the same technique as used in InternalClassFileEditorInput in JDT. Incidentally this also makes showing a git revision of an HTML page in the internal web browser work. The file is created inside a temporary directory; this enables us to use a simple file name (revision & original file name), which looks nicer in programs that show the file name than a (partially) auto-generated name as we'd get from createTempFile(). The file is set as read-only: a user cannot modify a git revision. We attempt to delete the temporary file and directory when the JVM terminates to avoid filling the system tmp directory. Bug: 463906 Change-Id: I355524f46a8ef66745f287adf718dfb8ea197b4a Signed-off-by: Thomas Wolf <>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/')
1 files changed, 1 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/
index ae69c0f41b..f51b402739 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/
@@ -1027,6 +1027,7 @@ FetchWizard_windowTitleWithSource=Fetch from: {0}
FileDiffContentProvider_errorGettingDifference=Can''t get file difference of {0}.
FileDiffLabelProvider_RenamedFromToolTip=Renamed from {0}
FileRevisionEditorInput_NameAndRevisionTitle={0} {1}
+FileRevisionEditorInput_cannotWriteTempFile=Cannot write temporary file for {0}.
FileTreeContentProvider_NonWorkspaceResourcesNode=Non-workspace files
FindToolbar_NextTooltip=Go to next commit matching the search criteria
FindToolbar_PreviousTooltip=Go to previous commit matching the search criteria

Back to the top