Getting Eclipse to open .html in text-editor by default?
Asked Answered
N

7

30

Eclipse Juno keeps opening my HTML files in a embedded web-browser, rather than in an embedded syntax-highlighting editor.

I have installed:

  • Web Page Editor
  • Eclipse Web Developer Tools
  • PyDev for Eclipse

Specifically see the screenshot of my install applications.

I need it to work with Django templates + any other Python templates with HTML + normal HTML+JS files.

How do I find this editor, and select it as default?

Nematic answered 6/8, 2012 at 15:22 Comment(2)
kind of superuser.com question.Tilford
Temporary fix: got it to work with django-editor. Imperfect because I require source formatting, and a dark-theme supported non-buggy syntax highlighter.Nematic
N
-3

Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.

This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working fine =).

None of the editors work the way I want them to though, however I have ended up with Django-Editor (which is slightly better than Aptana's one).

Nematic answered 25/8, 2012 at 16:48 Comment(0)
P
35

Select Window -> Preferences from the main Eclipse menu.

Select General -> Editors -> File Associations from the Preferences menu.

enter image description here

For .htm and .html, left click on the extension in the upper view. Left click on the Add button to the right of the lower view to add one or more HTML editors. Left click on your favorite HTML editor and left click on the Default button to make it the default editor.

If the extension you want is missing, left click on the Add button to the right of the upper view to add the extension.

Peyote answered 6/8, 2012 at 15:49 Comment(3)
Thanks, but now I'm unsure as to which editor to select. None seem relevant. Screenshot. Note that "Text editor" doesn't event provide syntax-highlighting.Nematic
I use Eclipse 3.6 for my HTML editing. I have "Web Page Editor" and "HTML Editor" as associated editors for HTML. I know one of these editors came from the Eclipse Web Tools Project. I don't remember what Eclipse plug-in provided the other HTML editor.Peyote
Remove Web Page Editor. HTML Editor should now be the top choice. This will get rid of the rendered page preview and will retain syntax formatting.Yachting
D
24

If you want to add an HTML editor to Eclipse:

  1. Go to Help -> Install New Software
  2. Choose the site http://download.eclipse.org/releases/your_eclipse_version
  3. Type the filter text Web Page Editor
  4. There should be one result. Check off the box and press the Finish button.

Installing the web page editor

Now you should have the option to choose the HTML editor when opening files by right-clicking, Open With -> HTML Editor.

If you want to always use the HTML editor to open HTML files then go to the Eclipse preferences -> General -> Editors -> File Associations. Select the extension up top (e.g. *.htm, *.html) then select the HTML editor in the bottom pane and press the Default button.

Making HTML editor the default

Domestic answered 24/8, 2012 at 18:44 Comment(1)
I have that package installed already. See my aforementioned screenshots.Nematic
P
3

I had a similar problem. Once I installed the html editor (thanks to CgodLEY), still my html files wouldnt show up with that editor. Solution? Right click on the html/htm file, go to "open with" and select "HTML editor". Fortunately that solve everything...

Palmitin answered 5/3, 2013 at 20:12 Comment(0)
T
3

For those still finding their way here, yes, do add an HTML editor to Eclipse as CgodLEY suggests, if you're having this problem. However, even if you already have an HTML editor in your Eclipse installation, consider installing CodeMix for a superlative HTML editing experience - take a look at the differences here.

Transform answered 12/7, 2018 at 15:15 Comment(1)
Here's a quick comparison that shows how much better the CodeMix HTML experience is versus base Eclipse.Trefler
T
2

Now, there's a Django-aware template editor available for free:

http://eclipse.kacprzak.org/

I installed it in Eclipse Kepler / Django 1.6, it's working fine for me.

Note: if you previously opened a specific .HTML file with some other editor, you need to go back to the project view, right click on the .HTML file, select 'open with...' and explicitly select Django editor.

Twodimensional answered 13/6, 2014 at 15:40 Comment(0)
B
0

To answer the opening of your question: Note that Eclipse will use the built-in web-browser to view html files if you are opening them outside of a project, as in "File->Open File ...", when that file isn't part of a project.

I just created a dummy project, and now the html files are correctly opened with the editor selected in my preferences. Success!

Bevatron answered 18/11, 2016 at 16:33 Comment(0)
N
-3

Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.

This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working fine =).

None of the editors work the way I want them to though, however I have ended up with Django-Editor (which is slightly better than Aptana's one).

Nematic answered 25/8, 2012 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.