Adding more resource navigator filters to ColdFusion Builder (Eclipse)

One thing that has always bugged the crap out of me is our inability to add additional resource filters to the navigator view in Eclipse. Specifically, I mean these:

Resource filters are very useful little tools that will hide anything that matches the filter from the navigator view. Which is great for things like .svn folders or any other crap you don't feel like you need distracting you at the moment. Like if you want to hide all the images in a project so that it is not as cluttered. But for some reason, we have never been able to add our own filters. So I can't, for example, hide the stupid Settings.xml file that CFB likes to add to my projects or the .settings folder. Grrrrr!!

Now you might ask, "Jason, why don't you just use the .* filter to hide anything that starts with a .(dot)?", to which I would answer, "because that still won't hide Settings.xml AND I don't want to hide anything that starts with a dot. My .htaccess files are part of my application and I need them to be available.

So my solution was to dig around in Eclipse and find the damn setting I need.

I found it.

Depending on how you installed ColdFusion Builder and what version you are using will determine where you will find the file that we need. The file we need is com.adobe.ide.coldfusion.ui_1.0.0.274293.jar.

If you are on CFB 1 it will have a different name than if you are using CFB 1 Update 1. So just do a file search for com.adobe.ide.coldfusion.ui_1.*, that should find it.

As ALWAYS, make a back up of this file before we start messing with it. In fact, make a back up of your entire CFB install. I will not be held responsible when you go and hose this up ;)

Once you have made your backup, take a copy of the jar file and put it somewhere where we can work with it. I like the desktop. Rename it from a .jar to a .zip and extract the zip file to your desktop(remember, jar files are just zip archives). You should now have a new folder on your desktop. There are two files in this folder that we need to edit.

In plugin.xml you will find a block of xml that looks like this:


<extension
     point="org.eclipse.ui.ide.resourceFilters">

     <filter pattern="*.cfc">
     <description>
     %filter.description.0
     </description>
     </filter>
     <filter pattern="*.cfm">
     <description>
     %filter.description.1
     </description>
     </filter>
     <filter pattern="*.cfml">
     <description>
     %filter.description.2
     </description>
     </filter>
     <filter pattern="*.css">
     <description>
     %filter.description.3
     </description>
     </filter>
     <filter pattern="*.gi">
     <description>
     %filter.description.4
     </description>
     </filter>
     <filter pattern="*.htm">
     <description>
     %filter.description.5
     </description>
     </filter>
     <filter pattern="*.html">
     <description>
     %filter.description.6
     </description>
     </filter>
     <filter pattern="*.js">
     <description>
     %filter.description.7
     </description>
     </filter>
     <filter pattern="*.lck">
     <description>
     %filter.description.8
     </description>
     </filter>
     <filter pattern="*.log">
     <description>
     %filter.description.9
     </description>
     </filter>
     <filter pattern="*.swf">
     <description>
     %filter.description.10
     </description>
     </filter>
</extension>

This is where we can define additional filters. So for each new filter, ad another <filter> block. Like this:


     <filter pattern="*.settings">
     <description>
     %filter.description.12
     </description>
     </filter>
     <filter pattern="*settings.xml">
     <description>
     %filter.description.13
     </description>
     </filter>
     <filter pattern="*.project">
     <description>
     %filter.description.14
     </description>
     </filter>

Notice I incremented the description number by 1 for each new filter. We'll see where that comes into play next. Really, I don't think this part is necessary, but I didn't feel like going back and testing it without doing the descriptions.

Once you have added all of the filters you want, open the plugin.properties file and look for this section:


filter.description.7 = JS.filter
filter.description.8 = Dreamweaver lock file filter
filter.description.9 = Log file filter
filter.description.10 = SWF filter
filter.description.11 = Text file filter

This is where you define the text that will fill in the description block from the plugin.xml file. Add these (or similar) values


filter.description.12 = settings file filter
filter.description.13 = settings folder filter
filter.description.14 = project file filter

Awesome. Now we are ready to roll these back into the jar file, cause they don't do us any good on our desktops.

Copy the files into the plugins/ folder where you found the com.adobe.ide.coldfusion.ui_1.*. Then go to your command line and navigate to that plugins/ directory.

Then run this command:


jar uvf com.adobe.ide.coldfusion.ui_1.0.0.274293.jar plugin.xml plugin.properties

The jar utility should report back to you that the two files were added. Next delete the two plugin(plugin.xml and plugin.properties) files from the plugins/ directory. We only needed them there temporarily.

Finally, launch Eclipse (You may need to use the -clean param the first time to get it to reload the plugins and catch these settings).

You should now have the new filters available.

Comments
Dan Vega's Gravatar Great find Jason, this has always bugged the heck out of me.
# Posted By Dan Vega | 8/10/10 1:00 PM
Aaron West's Gravatar Excellent post Jason, just what I was looking for to instruct CFB to hide my .git folders. Oddly, they've not displayed at all until I created a new workspace and mapped a new CFB project to my local folder. Not sure what's up with that.
# Posted By Aaron West | 10/5/10 12:32 PM
Raymond Camden's Gravatar It never ceases to amaze me that a tool as powerful as Eclipse seems to make so many bonehead UX choices. I can list more than one for sure. (My favorite being the ugly warning when you dare to edit a file outside of Eclipse and yeah, I know there is a way around it but jeeze!)
# Posted By Raymond Camden | 10/5/10 1:03 PM
Jason Dean's Gravatar Thanks Aaron.

I'm with you there Ray. I think that we need to do things like this is ridiculous.
# Posted By Jason Dean | 10/5/10 2:22 PM
Michael Horne's Gravatar Believe it or not, if you have CFEclipse, you can go into \plugins\org.cfeclipse.cfml_1.4.4.201012220425 and edit the plugin.xml and plugin.properties files in there and find the same blocks as in this post. You don't need to recompile into a .jar or anything.
# Posted By Michael Horne | 2/28/12 10:45 AM
Ben Riordan's Gravatar Does anyone have this working on ColdFusion Builder 2? The similar jar files still exist with the similar code blocks, but I could not get the added filters to show up. Thanks.
# Posted By Ben Riordan | 6/9/12 6:50 PM
Ben Riordan's Gravatar I am trying to do the same thing as Aaron - hide my git folders. At the very least adobe should add that file extension.

I made a feature request if you want to vote on it: https://bugbase.adobe.com/index.cfm?event=bug&...
# Posted By Ben Riordan | 6/9/12 6:54 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1. Contact Blog Owner