Merged branch master into R4_HEAD -- no conflicts
diff --git a/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/IAntCoreConstants.java b/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/IAntCoreConstants.java
index d969f33..7f137b3 100644
--- a/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/IAntCoreConstants.java
+++ b/ant/org.eclipse.ant.core/src/org/eclipse/ant/internal/core/IAntCoreConstants.java
@@ -124,4 +124,12 @@
 	 * @since org.eclipse.ant.core 3.3.0
 	 */
 	public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
+
+	/**
+	 * The name of the XML build file extension.
+	 * <br><br>
+	 * Value is: <code>xml</code>
+	 * @since 3.8
+	 */
+	public static final String XML_EXTENSION = "xml"; //$NON-NLS-1$
 }
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java
index 5f8933c..6b52ca3 100644
--- a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntUtilTests.java
@@ -124,5 +124,14 @@
             }
         }
         assertEquals("Did not find target: " + targetName, true, found);
-    }        
+    }      
+    
+    public void testIsKnownAntFileName() throws Exception {
+    	assertTrue("The file name 'foo.xml' is a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.xml"));
+    	assertTrue("The file name 'foo.ant' is a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.ant"));
+    	assertTrue("The file name 'foo.ent' is a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.ent"));
+    	assertTrue("The file name 'foo.macrodef' is a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.macrodef"));
+    	assertFalse("The file name 'foo.xsi' is not a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.xsi"));
+    	assertFalse("The file name 'foo.txt' is a valid name", AntUtil.isKnownAntFileName("a/b/c/d/foo.txt"));
+    }
 }
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntViewTests.java b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntViewTests.java
new file mode 100644
index 0000000..fbe4144
--- /dev/null
+++ b/ant/org.eclipse.ant.tests.ui/Ant Tests/org/eclipse/ant/tests/ui/AntViewTests.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ant.tests.ui;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+
+import org.eclipse.ant.internal.ui.AntUtil;
+import org.eclipse.ant.internal.ui.preferences.FileFilter;
+import org.eclipse.ant.internal.ui.views.actions.AddBuildFilesAction;
+import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PlatformUI;
+
+public class AntViewTests extends AbstractAntUITest {
+
+	public AntViewTests(String name) {
+		super(name);
+	}
+	
+	public void testAddBuildFilesAction() throws CoreException {
+		// Ensure that AddBuildFilesAction is present!
+		String viewId = "org.eclipse.ant.ui.views.AntView";
+		IViewPart view = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getActivePage().showView(viewId);
+		assertNotNull("Failed to obtain the AntView", view);
+		IViewSite viewSite = view.getViewSite();
+		assertNotNull("Failed to obtain view site", viewSite);
+		IToolBarManager toolBarMgr= viewSite.getActionBars().getToolBarManager();
+		assertNotNull("Failed to obtain the AntView ToolBar", toolBarMgr);
+		AddBuildFilesAction action = getAddBuildFilesAction(toolBarMgr);
+		assertNotNull("Failed to obtain the AddBuildFilesAction", action);
+	}
+
+	private AddBuildFilesAction getAddBuildFilesAction(IToolBarManager toolBarMgr) {
+		IContributionItem[] actions = toolBarMgr.getItems();
+		if (actions != null && actions.length > 0) {
+			for (int i = 0; i < actions.length; i++) {
+				if (actions[i] instanceof ActionContributionItem) {
+					ActionContributionItem actionItem = (ActionContributionItem) actions[i];
+					if (actionItem.getAction() instanceof AddBuildFilesAction) {
+						return (AddBuildFilesAction) actionItem.getAction();
+					}
+				}
+			}
+		}
+		return null;
+	}
+	
+	public void testAntBuildFilesExtensionFilter() {
+		// Ensure coverage for the extension filter used by AddBuildFilesAction 
+		// Create blocks to scope the vars to catch typos!
+		
+		{// Accept only a single extension
+			String extnFilter1 = "xml";
+			FileFilterProxy ff1 = new FileFilterProxy(extnFilter1);
+			assertTrue("xml is not accepted as a build file extension", ff1.canAccept("xml"));
+			assertFalse("ent is accepted as a build file extension", ff1.canAccept("ent"));
+		}
+		
+		{// Accept multiple extensions
+			String extnFilter2 = AntUtil.getKnownBuildFileExtensionsAsPattern();
+			FileFilterProxy ff2 = new FileFilterProxy(extnFilter2);
+			assertTrue("xml is not accepted as a build file extension", ff2.canAccept("xml"));
+			assertTrue("ant is not accepted as a build file extension", ff2.canAccept("ant"));
+			assertTrue("ent is not accepted as a build file extension", ff2.canAccept("ent"));
+			assertFalse("def is accepted as a build file extension", ff2.canAccept("def"));
+			assertTrue("macrodef is not accepted as a build file extension", ff2.canAccept("macrodef"));
+			assertTrue("XML is not accepted as a build file extension", ff2.canAccept("XML"));
+			assertFalse("macro is accepted as a build file extension", ff2.canAccept("macro"));
+		}
+	}
+	
+	private static class FileFilterProxy extends TypeProxy {
+		
+		Method canAcceptMethod = null;
+		
+		FileFilterProxy(String extnFilter) {
+			super(new FileFilter(Collections.EMPTY_LIST, extnFilter));
+		}
+		
+		boolean canAccept(String extn) {
+			if (canAcceptMethod == null) {
+				canAcceptMethod = get("canAccept", new Class[] { String.class });
+			}
+			Object result = invoke(canAcceptMethod, new String[] {extn});			
+			assertNotNull("Failed to invoke 'canAccept()'", result);
+			return ((Boolean)result).booleanValue();
+		}
+	}
+
+}
diff --git a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
index e6cc839..55b7d75 100644
--- a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
+++ b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AbstractAntUITest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- *  Copyright (c) 2003, 2009 IBM Corporation and others.
+ *  Copyright (c) 2003, 2012 IBM Corporation and others.
  *  All rights reserved. This program and the accompanying materials
  *  are made available under the terms of the Eclipse Public License v1.0
  *  which accompanies this distribution, and is available at
@@ -18,6 +18,8 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
@@ -35,6 +37,7 @@
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugPlugin;
@@ -480,4 +483,60 @@
         }
         return null;
     }
+	
+	/**
+	 * This is to help in increasing the test coverage by enabling access to fields and
+	 * execution of methods irrespective of their Java language access permissions.
+	 * 
+	 * More accessor methods can be added to this on a need basis
+	 */
+	protected static abstract class TypeProxy {
+
+		Object master = null;
+		
+		protected TypeProxy(Object obj) {
+			master = obj;
+		}
+		
+		/**
+		 * Gets the method with the given method name and argument types.
+		 *
+		 * @param methodName the method name
+		 * @param types the argument types
+		 * @return the method
+		 */
+		protected Method get(String methodName, Class[] types) {
+			Method method = null;
+			try {
+				method = master.getClass().getDeclaredMethod(methodName, types);
+			} catch (SecurityException e) {
+				fail();
+			} catch (NoSuchMethodException ex) {
+				fail();
+			}
+			Assert.isNotNull(method);
+			method.setAccessible(true);
+			return method;
+		}
+
+		/**
+		 * Invokes the given method with the given arguments.
+		 *
+		 * @param method the given method
+		 * @param arguments the method arguments
+		 * @return the method return value
+		 */
+		protected Object invoke(Method method, Object[] arguments) {
+			try {
+				return method.invoke(master, arguments);
+			} catch (IllegalArgumentException e) {
+				fail();
+			} catch (InvocationTargetException e) {
+				fail();
+			} catch (IllegalAccessException e) {
+				fail();
+			}
+			return null;
+		}
+	}
 }
\ No newline at end of file
diff --git a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java
index 42e5c03..93175cb 100644
--- a/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java
+++ b/ant/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2002, 2011 GEBIT Gesellschaft fuer EDV-Beratung
+ * Copyright (c) 2002, 2012 GEBIT Gesellschaft fuer EDV-Beratung
  * und Informatik-Technologien mbH, 
  * Berlin, Duesseldorf, Frankfurt (Germany) and others.
  * All rights reserved. This program and the accompanying materials 
@@ -18,6 +18,7 @@
 import junit.framework.TestSuite;
 
 import org.eclipse.ant.tests.ui.AntUtilTests;
+import org.eclipse.ant.tests.ui.AntViewTests;
 import org.eclipse.ant.tests.ui.BuildTests;
 import org.eclipse.ant.tests.ui.ModelProjectTests;
 import org.eclipse.ant.tests.ui.debug.BreakpointTests;
@@ -61,6 +62,7 @@
         suite.addTest(new TestSuite(XmlTagFormatterTest.class));
         suite.addTest(new TestSuite(XmlFormatterTest.class));
         suite.addTest(new TestSuite(AntUtilTests.class));
+        suite.addTest(new TestSuite(AntViewTests.class));
 		suite.addTest(new TestSuite(BreakpointTests.class));
 		suite.addTest(new TestSuite(RunToLineTests.class));
         suite.addTest(new TestSuite(SteppingTests.class));
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java
index 9144c0b..8378a48 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/AntUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -20,6 +20,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 import org.apache.tools.ant.Target;
 import org.eclipse.ant.core.AntCorePlugin;
@@ -379,6 +380,7 @@
 	 * Returns the list of Strings that were delimiter separated.
 	 * 
 	 * @param delimString the String to be tokenized based on the delimiter
+	 * @param delim the delimiter
 	 * @return a list of Strings
 	 */
 	public static String[] parseString(String delimString, String delim) {
@@ -388,6 +390,8 @@
 	/**
 	 * Returns an IFile with the given fully qualified path (relative to the workspace root).
 	 * The returned IFile may or may not exist.
+	 * @param fullPath the path to look up
+	 * @return the {@link IFile} which may or may not exist
 	 */
 	public static IFile getFile(String fullPath) {
 		return AntLaunchingUtil.getFile(fullPath);
@@ -622,10 +626,12 @@
     		IContentType type = Platform.getContentTypeManager().findContentTypeFor(filename);
     		if(type != null) {
     			IContentType antType = Platform.getContentTypeManager().getContentType(AntCorePlugin.ANT_BUILDFILE_CONTENT_TYPE);
-    			return type.isKindOf(antType);
+    			if(antType != null) {
+    				return type.isKindOf(antType);
+    			}
     		}
 			String[] names = getKnownBuildfileNames();
-			for (int i = 0; i < names.length; i++) {
+			for (int i = 0; names != null && i < names.length; i++) { // names can be null!
 				if(filename.endsWith(names[i])) {
 					return true;
 				}
@@ -658,11 +664,72 @@
 	 */
 	public static boolean isKnownBuildfileName(String filename) {
 		String[] names = getKnownBuildfileNames();
-		for (int i = 0; i < names.length; i++) {
+		for (int i = 0; names != null && i < names.length; i++) { // names can be null!
 			if(names[i].equalsIgnoreCase(filename)) {
 				return true;
 			}
 		}
 		return false;
 	}
+	
+	/**
+	 * A helper method to extract the build filename extensions as defined in the extender of the 
+	 * content-types extension-point.
+	 * 
+	 * @return An empty array or list of filename extensions as specified in the content-types extension
+	 * @since 3.8
+	 */
+	public static String[] getKnownBuildFileExtensions() {
+		IContentType antType = null;
+		String[] result = null;
+		try {
+			antType = Platform.getContentTypeManager().getContentType(AntCorePlugin.ANT_BUILDFILE_CONTENT_TYPE);
+			if(antType != null) {
+				result = antType.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+			}
+		} catch (Exception e) {
+			// Empty block and fall-thru is intentional!
+		}
+		return result == null ? new String[0] : result;
+	}
+
+	/**
+	 * A helper method to construct a RegEx pattern out of the extensions
+	 * 
+	 * @return A String that is a RegEx pattern representing the extensions
+	 * @since 3.8
+	 */
+	public static String getKnownBuildFileExtensionsAsPattern() {
+		String[] extns = AntUtil.getKnownBuildFileExtensions();
+		if (extns.length == 0) {
+			return IAntCoreConstants.XML_EXTENSION;
+		}
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0; i < extns.length; i++) {
+			if (i > 0) sb.append('|');
+			sb.append(extns[i]);
+		}
+		return sb.toString();
+	}
+	
+	/**
+	 * Returns if the given file name is known as a build file. This method consults
+	 * all of the known file extensions from the Ant-defined content types
+	 * 
+	 * @param name
+	 * @return <code>true</code> if the file name matches an Ant build file pattern <code>false</code> otherwise
+	 * @since 3.8
+	 */
+	public static boolean isKnownAntFileName(String name) {
+		StringBuffer buf = new StringBuffer(".*.("); //$NON-NLS-1$
+		buf.append(getKnownBuildFileExtensionsAsPattern());
+		buf.append(")"); //$NON-NLS-1$
+		try {
+			Pattern p = Pattern.compile(buf.toString());
+			return p.matcher(name).matches();
+		}
+		catch(PatternSyntaxException pse) {
+			return false;
+		}
+	}
 }
\ No newline at end of file
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java
index 7e35947..12dd00d 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntLaunchShortcut.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -558,7 +558,8 @@
 				filepath = locationProvider.getPath(input);
 			}
 		}
-		if(filepath != null && "xml".equals(filepath.getFileExtension())) { //$NON-NLS-1$
+		
+		if(filepath != null && AntUtil.isKnownAntFileName(filepath.toString())) {
 			List list = collectConfigurations(filepath);
 			return (ILaunchConfiguration[]) list.toArray(new ILaunchConfiguration[list.size()]);
 		}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java
index 987136c..a9d78ea 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/launchConfigurations/AntTabGroup.java
@@ -11,6 +11,7 @@
  *******************************************************************************/
 package org.eclipse.ant.internal.ui.launchConfigurations;
 
+import org.eclipse.ant.internal.ui.AntUtil;
 import org.eclipse.ant.internal.ui.IAntUIHelpContextIds;
 import org.eclipse.core.externaltools.internal.IExternalToolConstants;
 import org.eclipse.core.resources.IFile;
@@ -87,8 +88,7 @@
 		IResource resource = DebugUITools.getSelectedResource();
 		if (resource != null && resource instanceof IFile) {
 			IFile file = (IFile)resource;
-			String extension = file.getFileExtension();
-			if (extension != null && extension.equalsIgnoreCase("xml")) { //$NON-NLS-1$
+			if (AntUtil.isKnownAntFile(file)) {
 				String projectName= file.getProject().getName();
 				StringBuffer buffer = new StringBuffer(projectName);
 				buffer.append(' ');
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/FileFilter.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/FileFilter.java
index 7ed9dde..ab3951b 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/FileFilter.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/FileFilter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.regex.Pattern;
 
 import org.eclipse.ant.internal.ui.AntUIPlugin;
 import org.eclipse.core.resources.IContainer;
@@ -38,6 +39,8 @@
 	private Set fFiles;
 	
 	private String fExtension;
+	
+	private Pattern fExtnPattern;
 
     private boolean fConsiderExtension= true;
 
@@ -48,7 +51,13 @@
 	 */
 	public FileFilter(List objects, String extension) {
 		fFilter = objects;
-		fExtension= extension;
+		fExtension = extension;
+		if (extension.indexOf('|') > 0) { // Shouldn't be the first char!
+			// This is a pattern; compile and cache it for better performance
+			fExtnPattern = Pattern.compile(fExtension, Pattern.CASE_INSENSITIVE);
+		} else {
+			fExtnPattern = null;
+		}
 	}
 
 	/* (non-Javadoc)
@@ -83,7 +92,7 @@
 				if (resource instanceof IFile) {
 					IFile file = (IFile) resource;
 					String ext = file.getFileExtension();
-					if (!fConsiderExtension || (ext != null && ext.equalsIgnoreCase(fExtension))) {
+					if (!fConsiderExtension || canAccept(ext)) {
 						set.add(file);
 						added = true;
 					}
@@ -98,6 +107,19 @@
 		}
 		return added;
 	}
+
+	private boolean canAccept(String ext) {
+		if (ext != null) {
+			if (fExtnPattern == null) {
+				// Accepting only a single extension
+				return fExtension.equalsIgnoreCase(ext);
+			}
+			// Accepting multiple extensions
+			// eg: "xml|ant|ent|macrodef"
+			return fExtnPattern.matcher(ext).matches();		
+		}
+		return false;
+	}
 	
 	/**
 	 * Sets whether this filter will filter based on extension.
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java
index fa1cb7d..3f93205 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AddBuildFilesAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@
 	public void run() {
 		String title= AntViewActionMessages.AddBuildFilesAction_2;
 		String message= AntViewActionMessages.AddBuildFilesAction_4;
-		String filterExtension= "xml"; //$NON-NLS-1$
+		String filterExtension= AntUtil.getKnownBuildFileExtensionsAsPattern();
 		String filterMessage= AntViewActionMessages.AddBuildFilesAction_5;
 		
 		FileSelectionDialog dialog = new FileSelectionDialog(Display.getCurrent().getActiveShell(), getBuildFiles(), title, message, filterExtension, filterMessage);
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AntViewActionMessages.properties b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AntViewActionMessages.properties
index 3882ba9..4b05eff 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AntViewActionMessages.properties
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/views/actions/AntViewActionMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
+# Copyright (c) 2000, 2012 IBM Corporation and others.
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@
 AddBuildFilesAction_2=Buildfile Selection
 AddBuildFilesAction_3=Adding Buildfile(s)...
 AddBuildFilesAction_4=&Choose the buildfiles to add:
-AddBuildFilesAction_5=&Only show *.xml files
+AddBuildFilesAction_5=&Only show build files
 RemoveAllAction_Remove_All=Remove A&ll Buildfiles
 RemoveAllAction_0=Remove All from View
 RemoveAllAction_1=Are you sure you want to remove all buildfiles from the view?