2

I have looked all over the internet and stackoverflow for an answer yet they are all too vague for me to understand.

I want to set the associated editor, Web Browser, as a default for .html files without accessing Windows->Preferences->etc. After reading on the internet I somewhat understand what I have to write.

However, if someone could give me an example of what I have to do, and most importantly WHERE I am doing it, than that would be fantastic. There are a lot of examples of what and how to do, but none specify where in my Eclipse folder I should be looking. A plugin, an xml file, etc.

Thank you.

izhodzis
  • 59
  • 8
  • An editor can outright declare itself the default (in which case it's a tossup as to which editor wins when more that one declares itself default), but there's no programmatic way to change it. That's for the user. – nitind Jul 23 '14 at 21:50
  • I thank you for your answer, however I found a way to change it. Specifically for .html at least. If you go into the workspace of eclipse, into the plugin settings there is a way to modify the preferences to make Web Browser the default editor. – izhodzis Jul 24 '14 at 14:34
  • Can you go into more detail? – nitind Jul 24 '14 at 14:47
  • Could you give me your email? The responce wont fit in the comment box :P – izhodzis Jul 24 '14 at 14:57
  • How about the Answer box? – nitind Jul 24 '14 at 14:57
  • Oh Im stupid (I dont use stack overflow often) – izhodzis Jul 24 '14 at 15:02
  • http://stackoverflow.com/questions/26113234/how-to-change-eclipse-preferences-programmatically – Paul Verest Sep 30 '14 at 05:16

1 Answers1

1

Ill just map out what I did. First I downloaded eclipse and opened it with two workspaces (workspace1 and workspace2). Then, I opened eclipse with on of these two and went into preferences and changes Web Browser to the default editor for .html files. Then I opened a comparative program (something that opens up two folders/files and shows the side by side highlighting differences, I used Araxis Merge) and viewed the workspaces and saw that under workspace2\.metadata\.plugins\org.eclipse.core.runtime\.settings a new file had been made. (workspace.prefs) I opened the unedited and edited workspace.prefs file in the same comparative program and found a like was inserted. This line was:

<defaultEditor id\="org.eclipse.ui.browser.editorSupport"/>\r\n. 

So having found that line, and where to insert it in the .prefs you can write code that will find the location where that line needs to be inserted. and insert it. It is honestly a painstacking process, but my father (I was doing this ask for him at work) wanted to write a piece of code that clients could simply run and have it edit their prefs.

:) Hope this helps.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
izhodzis
  • 59
  • 8