45

When using the open file dialog on Eclipse, many file types open in the internal editor as expected (.java, .txt). However, others open in an external editor. For example on my system attempting to open .sh file causes it to open it in emacs, and .py files open in bluefish.

How do I tell eclipse to open all files in the internal editor. I don't want to make an association for each type explicitly; I just want everything to open in the internal editor by default.

4
  • 1
    To clarify here, do you mean double clicking a file in Eclipse, or in the OS file explorer? I am having the same problem where all of the files in eclipse are defaulting to the system editor, even when there is a specific editor (e.g. c/c++ for .c files) associated. Aug 3, 2011 at 12:43
  • 1
    @Chris: In eclipse
    – Draemon
    Aug 6, 2011 at 13:31
  • 1
    @studiohack: care to justify how this isn't a "real question" - I think I've been pretty clear, and the 4 people who have marked it as a favourite probably want a good answer too.
    – Draemon
    Jan 8, 2012 at 21:19
  • 1
    I don't know why this question was closed. I have the same problem. I click a JAVA!! file in eclipse (Juno) and it opens in a notepad application (default windows handler)
    – Ben
    Sep 4, 2012 at 7:08

8 Answers 8

17

The problem with this is that when Eclipse doesn't know what to do with a given file, it opens it with the so called "System Editor", which actually is... whatever your OS says it is, hence the "rolling dice effect". I don't think you can tell the OS to use Eclipse as the default editor (though I didn't try; anyway I wonder why anyone would actually want to do it), so you have two alternatives: either install an eclipse plug-in to manage the kind of file you want to edit (like e.g. pyDev for python), or go to Window > Preferences > Editors > File Associations and associate your file extensions to the built-in text editor in Eclipse.

I happen to be a heavy user of Vim, Emacs and Eclipse, and for this job Emacs is definitely not what you really want, though if you want to try it for its own merits, Emacs can substitute Vim quite well (modal interface and all), look for viper and vimpulse.

FYI: I came here after reading your post

2
  • 1
    Thanks for your response. The system associations make sense when opening files from a file explorer / the desktop / etc. All I want is an option to default to the internal text editor rather than an external application even if I haven't installed a specific plugin (granted they may be useful, but the default behaviour should be sane).
    – Draemon
    Aug 6, 2011 at 13:35
  • FWIW, having a specific plugin does not entirely resolve the problem. For example, I switched from Eclipse PDT's editor to an external editor (Sublime Text 2). I'm tired of that editor now and want to switch back, but it does not seem to be trivial to get the original syntax-highlighted editor back. Nov 7, 2011 at 17:44
14

I have the same pain. You might want to add the extensions you want to open with the internal editor to Eclipse's "File Associations". They are found (in my MacOS version) in Preferences>General>Editors>File Associations, list the types you want opened internally, and chose "Text Editor (defalut)" as "Associated editors". I hope this helps.

1
  • Worked for me in Aptana.
    – DanH
    Apr 14, 2014 at 3:23
11

There is a new setting in eclipse 4.6.

Open Preferences > General > Editors > File Association

Find the option Open unassociated files with and select Text Editor

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

1
  • The problem I have here is eclipse is opening Java files (??!) in notepad++. When I go to the file associations I can add eclipse as an external source, but I can't get rid of "Java Editor" or "Text Editor". Feb 26, 2020 at 16:38
4

If you right-click the file in the Package Explorer/Navigator, you will see an Open-With menu item where you can select how the file should be opened. So, if you need to edit an .sh file just right-click and select Open With > Text Editor. There is also the Other... submenu item where you could pick other modes for Eclipse to open the file.

1
  • 1
    I clicked Open with -> Other then selected external programs and then chose eclipse. It worked for me. Thanks
    – Devendra
    Feb 20, 2015 at 18:06
3

There is a plugin for this that works fine for me: https://github.com/eclipselabs/default-text-editor

Note that I couldn't install it via the repo or dragging and dropping the install button, just by searching for the term Default Text Editor from Eclipse Marketplace from inside the IDE and installing it from there. Once installed, though, it worked perfectly.

1

I think I can add to the above content provided by others. Someone might feel it helpful. How to make the text editor in eclipse as default Editor:

  1. on the top pane of Eclipse in the task bar you will see "Window". click on "window" and select "preferences". A small window will be popped-up.

  2. Now in that small popped window got to General->Editors. now Click on File Associations. After clicking on FileAssociations you will see two windows on the right side.

  3. Now please add the file type in the top window. Example say, i want to make text editor as default for some "*.prop" files. so I clicked on the "Add" button that was beside the top window. It will ask you to type the FileType in a small pop-Up. please type there like "*.prop" and it will get saved and u will see your entered file Type there in the top window.

  4. Now please add the File editors that you want as default for that particular FileType you just added. Example say, On the above step i added "*.prop". so please click on the "*.prop" that is visible in the top window and right way click on the "Add" button just beside bottom window. it will pop-up to choose your editor, so add ur editor. Eclipse will automatically make it as default, if not please select that editor that you added just now and click on the default button that was just beside that bottom window.

1
  • Please note that "above" has no context here. Answers can be sorted a number of different ways. Your answer could very well be above all of the others. Better to reference other answers with a link, or at least mentioning the author.
    – ale
    Jan 20, 2014 at 16:18
1

Opening a single file in editor

Right click on file, Open with -> Other then select external programs and then choose eclipse.

Setting eclipse to open files *.c or *.cpp etc. by default

Window -> Preferences -> Editors -> File Associations

Add files types *.c and *.cpp. Here for each file type i.e. *.c or *.cpp, you can choose editor. So choose eclipse as editor for each file type.

This will open your files by default in eclipse editor. Note, the icons for files will be changed to eclipse icon after this setting

1

Eclipse -> Preferences -> General -> Editors -> File Associations ->

Set: Open unassociated files with: Text Editor.

Select all File types and click Remove.

enter image description here

2
  • How your answer differ from already provided answers? Jul 25, 2017 at 6:39
  • by "Select all File types and click Remove." which finally made all other solutions work. Jul 25, 2017 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .