Fix #262: unhandled exception for SQL editor

Certain editors simply don't implement IFileEditorInput yet we did an
unconditional cast. Ask the input to adapt to IFile instead, then let
the caller deal with any null values.

Whilst we are at it, handle `null` values gracefully for the "open in
vim" command.