Tuesday, April 6, 2010

Don't let Aptana's XML Editor mess your Eclipse

After installing Aptana's RadRails in my Eclipse 3.5, I found my Maven project's pom.xml didn't behave as previous any more. Double click invoked a XML editor instead of Maven POM editor. After an investigation, I found that RadRails installed "Aptana XML editor" and set it as default, which caused Eclipse never chose the correct editor according to content-type of XML files. This is annoying for some XML files, such as POM and JUnit surefire-reports.

After you remove RadRails, Eclipse's default behavior comes back. However, you cannot remove "Aptana XML editor" only because it is packed with other packages. Finally I figured out a way so that you don't need to remove RadRails.

The following steps show how to fix this problem:
  1. Go to Windows->Preferences
  2. Then General->Editors->File Associations
  3. Find "*.xml" in File types, click it
  4. You will find the list of XML editors, you may find "Aptana XML Editor" with default
  5. Click "Remove" button for "File Types" to delete the file type "*.xml"
  6. Click "Add .." button for "File types", and fill "*.xml" in the dialog
  7. Then you will find all editors are listed in "Associated Editors", but "Aptana XML editor" is not default any more.
  8. Restart Eclipse, this configuration should be kept for your workspace.

The following two solutions are tested and didn't work:
  1. Just deleting "*.xml" file type doesn't work because Aptana XML editor becomes default again when you restart Eclipse.
  2. Setting another editor as default cause the same problem because no content-type detection if there exists an default editor.
Aptana should respect Eclipse's content-type.

2 comments:

  1. Thanks guy, I struggled with this for a month so far :( But now it is fixed!!
    In my case it was the Android plugin that screwed up my eclipse.

    ReplyDelete