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 <thomas.wolf@paranor.ch>