Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using Eclipse, I can open a Java source file with an external editor by right-clicking on the file name (in the Package Explorer) and selecting Open With ... -> emacsclient.

I'm very glad to be able to do that. However, I only want to do that sometimes, not every time. Now, when I double-click on that same file name, I always automatically get the file opened in emacsclient. This is particularly annoying when I use the Open Type dialog to find a file, because in that case it's not possible to right-click and choose the default Eclipse editor.

Is there a way to make Eclipse forget that I previously opened a particular file with emacsclient, so that it can go back to the default behavior of using the regular Eclipse editor?

share|improve this question
    
What I now do, as a workaround, is this: whenever I open a file in the external editor (using the right-click, Open With ... trick as I mentioned), I then immediately go back and repeat the "right-click, Open With ..." and this time choose "Java Editor". This resets Eclipse to the default behavior (makes it "forget" that I previously opened the file with the external editor). But what I really wish is that I could somehow do "Open With ... (external editor) ... just this once", so that I wouldn't have to use this 2-step procedure. –  user54690 Oct 16 '12 at 1:20

2 Answers 2

Window > Preferences > General > Editors > Restore Defaults

Or you can manually edit file associations.

share|improve this answer
    
Thank you for replying. However, it doesn't quite work as I had hoped. First, "Restore Defaults" didn't seem to have any effect. As for manually editing the file associations, the only way I could get that to work was to remove "emacsclient" from the list of allowable editors altogether. I still want to be able to use emacsclient at times; just not every time by default. –  user54690 Apr 13 '12 at 18:55
  1. Window > Preferences > General > Editors > File Associations.

  2. If .java is not in the list of file types in the top window, add it.

  3. With .java selected in the top window, go to the bottom window and add the internal editor you wish to use.

(This is in Indigo, not sure if it's the same in other versions).

share|improve this answer
    
This answer has completely missed the point of my question. –  user54690 Oct 16 '12 at 1:15
    
Not sure why -- this is exactly what you need to do to make sure Eclipse always opens Java files with the editor you choose. –  cpetty Oct 17 '12 at 16:35
    
I'm not sure how much more plainly I can say it, but I'll try again. I want to use an external editor only occasionally. I want the usual/default behavior to be that the Java source files open in the Eclipse internal Java editor. Occasionally I want to open one particular file with the external editor, but I don't want that choice to be "sticky". The next time I visit that file, I want the default to have reverted to the usual Eclipse internal Java editor, and I want that "reverting" to happen automatically. Got it? –  user54690 Oct 27 '12 at 1:32
    
Got it. My Eclipse is already working that way: .java files are opened by the internal Java editor. I can use "Open With..." to open a file with an external editor (SlickEdit) and it does; I then try double clicking on the same or other .java files and they all open with the default editor. So not sure what's happened in your environment to cause the "Open With..." choice to stick. Does opening with emacsclient create a new File Association for you? –  cpetty Oct 29 '12 at 18:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.