Associating *.theme and *.xsp-config with Eclipse XML Editor

When you do XPages OSGi Library development in eclipse, you will often have to edit xml files (or xhtml) that have a different file extension than .xml

These are files such as XPages theme files with the .theme extension, and Xsp control configuration files with the .xsp-config extension.

Unfortunately these file extensions are not associated with the XML Editor by default and this causes undesirable behaviour when you double-click them to open them for editing.

When you attempt to open a .theme file, Eclipse thinks you want to apply an eclipse theme and you end up with this lovely error.

cantapply

Opening the xsp-config file is just as fun. First if you double click you get notepad (on windows)

 

opennotepad

So you might instead try to Open With -> Xml Editor

openwithxml

 

but then you get this:

unsupported

and end up with the normal text editor (with no pretty colours!)

xspconftext

So how do we fix this? We have to add these as content types in the preferences section as below.

Find the ‘XML’ Content Type and select it, click ‘Add..’ in the File associations section, type in the new extension to associate and click ok

In the picture below I am doing it for *.theme files and you can also see I have already done it for *.xsp-config

addcontenttype

 

Now let’s see what happens when we double click our theme file:

theme working

We have our pretty colours and XML editor!

and xsp-config?

xsp-config working

 

And if you are crazy like me and are playing around with loading xpages from within a plugin using the XPages Bazaar then maybe you will do it for .xsp too 🙂

xsp view working

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *