It does not look like it is possible to change or add a file association without using internal classes.
You can get the existing file associations with:
IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
IFileEditorMapping [] mappings = editorRegistry.getFileEditorMappings();
but updating the list requires using the EditorRegistry
implementation of IEditorRegistry
and this is an internal class. The implementation of IFileEditorMapping
is also internal.
Update:
The org.eclipse.ui.editors
extension point does have a command
attribute for running an external program and a launcher
attribute for running a program via a IEditorLauncher
class. You might be able to use one of those.