How do I make an editor the default editor for all unknown files in Eclipse?

Eclipse

Eclipse Problem Overview


I regularly open files of different types in Eclipse. For many types, Eclipse uses the system editor by default. I don't want this to happen. I want Eclipse to use the built-in Text Editor for unknown file types. However all I can find are options to set the default editor for a certain file type, but not for all unknown ones. Is there an option to do this?

Eclipse Solutions


Solution 1 - Eclipse

I don't think you can do this in one swoop, however:

> Windows > Preferences > General > Editors > File Association.

If you don't have a LOT of unknown file types, just type *.junk, *.punk, *.clunck and add Text Editor as the default editor.

Sadly you can't use *.* here.

Solution 2 - Eclipse

This issue with file associations is something that has always annoyed me with Eclipse. It is specially frustrating if you are trying to use Eclipse to edit files that don't have a file extension because then you can't even set a editor.

I searched over the Eclipse bug database and found my exact issue there. It was first reported in 2003 and up until now there is no solution for it. If you follow the long comment track over the years you will see that there is no way of setting a default editor for unknown file types. From what I gathered the problem boils down to eclipse not looking at the content of file to try to determine the type. Instead it fully depends on the file extension.

Some people have made suggestions for fixes but again nothing has come out of that. If you search the bug tracker DB you will find a lot more bugs created around this.

Solution 3 - Eclipse

A clean solution to this is finally implemented in Eclipse.

On the Preferences > General > Editors > File Association page, you can now define an editor selection strategy for unassociated file types.

Source: https://www.eclipse.org/eclipse/news/4.6/platform.php#text-editor-selection-strategy

Solution 4 - Eclipse

There is an Eclipse plugin that overrides the default behavior of the platform and opens text file of unknown type in the plain text editor of Eclipse instead in an external editor.

https://github.com/eclipselabs/default-text-editor

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionThomas LötzerView Question on Stackoverflow
Solution 1 - EclipseAliView Answer on Stackoverflow
Solution 2 - EclipsejkysamView Answer on Stackoverflow
Solution 3 - EclipsebrunobgView Answer on Stackoverflow
Solution 4 - EclipseKaloyan RaevView Answer on Stackoverflow