Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 373613 - 'Add Buildfiles' dialog should filter on known Ant file types, not just XML
Summary: 'Add Buildfiles' dialog should filter on known Ant file types, not just XML
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2 M7   Edit
Assignee: Pradeep Balachandran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 352376 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-07 23:09 EST by Michael Rennie CLA
Modified: 2013-07-10 14:29 EDT (History)
1 user (show)

See Also:


Attachments
Code changes and associated JUnit test cases (14.27 KB, patch)
2012-04-16 12:40 EDT, Pradeep Balachandran CLA
no flags Details | Diff
Code changes and associated JUnit test cases after incorporating the review comments. (17.02 KB, patch)
2012-04-23 22:55 EDT, Pradeep Balachandran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2012-03-07 23:09:57 EST
Version: 4.2.0
Build id: I20120306-2200

Steps:

1. open the Ant view
2. select the 'Add Buildfiles' view action
3. notice in the resulting dialog the checkbox that reads "Only show *.xml files"

Since the idea of this dialog is to select a buildfile to add to the view and the checkbox is supposed to help you do that by applying some filtering, it would be better if it read "Only shown known build file types (*.xml, *.ent, etc)" - or something similar to express that .xml is not the only extension for a buildfile. 

Valid buildfiles can be named *.xml, *.ant, *.ent, *.macrodef
Comment 1 Pradeep Balachandran CLA 2012-04-16 12:40:05 EDT
Created attachment 214059 [details]
Code changes and associated JUnit test cases
Comment 2 Pradeep Balachandran CLA 2012-04-16 12:44:16 EDT
The code changes contain the following:
(1) Updated label for the check box in the 'Add Buildfiles' dialog
(2) Enhanced file-filtering to accept *.xml, *.ant, *.ent, *.macrodef as build files

There are two test cases
(1) Just to ensure that 'Add Buildfiles' action exists
(2) A unit test for the change to the file-filtering algorithm
Comment 3 Michael Rennie CLA 2012-04-17 11:04:53 EDT
(In reply to comment #1)
> Created attachment 214059 [details]
> Code changes and associated JUnit test cases

Thanks for the patch + regression tests Pradeep! I would probably change the extension check code to use AntUtil.isKnownAntFile, that way if we extend the content description for known Ant file types we don't have to hunt down uses of Ant file extensions.
Comment 4 Pradeep Balachandran CLA 2012-04-18 09:21:41 EDT
(In reply to comment #3)
> 
> I would probably change the extension check code to use AntUtil.isKnownAntFile,

Good point! Thanks for pointing me to AntUtil. Since the current set of extensions (which are considered to be ANT files) come from the ANT ContentType, we should use this instead of just checking the extensions explicitly (I just enhanced the existing piece of code there which was following a similar approach). 

I shall incorporate this change and post another patch.
Comment 5 Pradeep Balachandran CLA 2012-04-23 22:55:10 EDT
Created attachment 214430 [details]
Code changes and associated JUnit test cases after incorporating the review comments.

Modified AntUtil to include a couple of helper routines to get the file extensions defined as build file extensions in the ANT content-type.

Thus this patch is same as previous one except for the following:
(1) Added a couple of helper routines to AntUtil
(2) Modified AddBuildFileAction and AntViewTests to use helper routine.
Comment 6 Pradeep Balachandran CLA 2012-04-24 04:31:15 EDT
Just to clarify, of the three code changes in AntUtil, only one is related to this bug while the other two are to fix potential NPEs that caught my attention.
Comment 7 Michael Rennie CLA 2012-04-24 13:31:19 EDT
Pushed patch + minor update to add isKnownAntFileName util method:

http://git.eclipse.org/c/platform/eclipse.platform.git/commit/?id=23acda54cf28d69b78dc5aab8c5752424ee28908

Thanks Pradeep!
Comment 8 Michael Rennie CLA 2013-07-10 14:29:25 EDT
*** Bug 352376 has been marked as a duplicate of this bug. ***