Using the EclipseColorer plugin, you can easily add support for it. For this tutorial I’ll be using Eclipse Classic 3.7.2 32-bit.
- Go to Help -> Install New Software and click Add..
- In the Name field write Colorer and in the Location field write http://colorer.sf.net/eclipsecolorer/
- Select the entry you’ve just added in the work with: combo box, wait for the component list to populate and click Select All
- Click Next and follow the instructions
- Once the plugin is installed, close Eclipse
- Copy your HRC file to [EclipseFolder]pluginsnet.sf.colorer_0.9.9colorerhrcautotypes
- Use your favorite text editor to open [EclipseFolder]pluginsnet.sf.colorer_0.9.9colorerhrcautoempty.hrc
- Add the appropriate prototype element. For example, if your HRC file is d.hrc, empty.hrc will look like this:
<?xml version="1.0" encoding='Windows-1251'?> <!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN" "http://colorer.sf.net/2003/hrc.dtd" > <hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd" ><annotation><documentation> 'auto' is a place for include to colorer your own HRCs </documentation></annotation> <prototype name="d" group="main" description="D"> <location link="types/d.hrc"/> <filename>/.(d)$/i</filename> </prototype> </hrc>
- Save the changes and close the text editor
- Open Eclipse and go to Window -> Preferences -> General -> Editors -> File Associations
- In the file types section, click Add.. and fill in the appropriate filetype (for example .d)
- Click OK and click your newly added entry in the list
- In the associated editors section, click Add.., select Colorer Editor and press OK
All done! Now you can open your new language files in Eclipse and enjoy syntax highlighting and parsing.