Overcoming the Eclipse XML autocomplete bug

December 8 2010


Mule configuration files are Spring XML files by nature. So the XML editor is an important development tool and provides a lot of benefit. When working in , it provides:

  • Schema documentation assistance for the element you are configuring
  • Validation of your schema and context of any errors that are detected
  • Autocomplete of elements and attributes based on what is valid in the current element of configuration you are editing

However, Eclipse’s XML editor (provided as part of the WTP project) does not properly handle autocomplete with schema substitution groups. Unfortunately, we use those substitution groups a lot in Mule so we filed a bug with the Eclipse project. Half a year later someone attached patch to address the issue. Since then there was not much activity on the issue with respect to getting the fix into an Eclipse release.

As part my work on Mule IDE I sat down and created an update site that you can use to install the patch from. Our list of favorite Eclipse XML editor bugs has the update site links.

To test that the patch actually works just create a new Mule configuration file and start typing:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
       http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd">

    <flow name="MyFlow">
        <vm: .... press space here ...

Note the difference: before you installed the patch autocomplete would just not work and you’d be left guessing what elements the VM transport would support here. Now, with the patch installed, you actually get autocomplete!

This patch is useful when working with XML based on any schema that makes use of substitution groups. Feel free to use it even if you do not use Mule’s IDE. While rolling out the patch via a custom update site works I’d rather like to see the issue properly fixed and rolled out in the next Eclipse release. You can help to make it happen by going to Eclipse bug 247312 and casting your vote.

We'd love to hear your opinion on this post

7 Responses to “Overcoming the Eclipse XML autocomplete bug”

  1. Thanks Dirk, that will make things so much easier!

  2. Does this work? I’m currently using this plug-in with Mule IDE on Eclipse Helios and I don’t see any difference at all – the context sensitive help on the Mule 3 configs remains nill, which makes it very painful to write Mule XML.

  3. Hassan, the patch improves the XML editing but is not perfect either. There are still situations where autocomplete does not work at all.

  4. It turns out that the SR2 release of Eclipse Helios included a newer version of WTP which take precedence over the patched ones we publish on the update site.

    I have re-created the patch for Helios using the respective plugin versions and uploaded everything to the update site.

  5. Thanks for the new patch for Eclipse Helios SR2. Could you also re-create a patch for Eclipse Indigo (released a few days ago) ? Best regards from Belgium 😉

  6. Thanks for the patch. I can now complete model, service, inbound tags, but I can’t complete stdio: or vm: tags. Any idea ?

    (Eclipse Helios SR2 and patch install).

    • The patch helps – but is still a patch and no full solution to the schema autocomplete issue. Any help getting this fixed for good in Eclipse is more than welcome.