Gnome, whether under redhat or ubuntu, is very hard to configure. Especially controlling the behaviour when you double-click on a file. However I may've got it cracked.
First, the easy way, is right-click a file, choose properties, and there is the open with tab. The setting there affects all files with that extension. (I still think that is one of those things that isn't even obvious once you know about it!)
But sometimes that is not enough. E.g. *.as files were associated with x-applix-spreadsheet, instead of my text editor. And then it then complains I'm trying to open a suspicious file.
Solution: I created this xml file as
<?xml version="1.0" encoding="UTF-8"?>
Wow, that seemed to do the job!