How to remove the lock in file association in ecli

2020-08-14 07:56发布

问题:

IN Eclipse i want to chnage the default editor of some .htm files.

If i try to go to FIle Association and assiciate the default editor then file gets opened in that new editor but i don't get the syntax highlighting.

The solution is that the file association is locked ny some plugin editor

Preferences -- Context type----text ----Your editor -- reomve the extension

But i get the .htm(locked) so i cant remove it.

http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-content-type.htm

Note: Certain items will be marked as "locked". An item is locked if it is one of the associations provided by the plug-in that declares the content type. In other words, you can remove only user-contributed associations.

Is there any way to remove those locks even thought it can be hackish way but i want to do it

回答1:

You don't need to "unlock" an existing association to add a new association and make it the default.

  1. Add a new association via the "Add" button
  2. Select the new entry
  3. Hit the "Default" button to make your new entry the default editor



回答2:

Could it be, that you want to change the "File Association"? This can be done in General / Editors / File Associations. BUT Eclipse uses at least one default-editor and this is the reason for the "locked"-message in the "Content Types". You could set the "Text Editor" to all unwanted types. Looks like a workaround, but makes sense, because it is the same as the file associations of your operating system, that asks you for the program to display the file.

Another question is, why do you want to unlock or remove the "Content Type"? Does it change anything in the Eclipse logic?



回答3:

Go see this answer from "Greg Desmarais" (assign the desired editor to "default")

https://stackoverflow.com/a/15642583/162094