Polished fix for bug 402009: Whole word API and UI should not allow to be true if regex is true
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
index 810d56e..ea4246f 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
@@ -9,7 +9,6 @@
  *     Markus Schorn - initial API and implementation
  *     Christian Walther (Indel AG) - Bug 399094: Add whole word option to file search
  *******************************************************************************/
-
 package org.eclipse.search.ui.text;
 
 import org.eclipse.core.runtime.CoreException;
@@ -21,6 +20,7 @@
 import org.eclipse.search.internal.ui.SearchPlugin;
 import org.eclipse.search.ui.ISearchQuery;
 
+
 /**
  * Abstract base class for text search query providers supplied via the <code>org.eclipse.search.textSearchQueryProvider</code>
  * extension point. The plug-in preference <code>org.eclipse.search.textSearchQueryProvider<code> defines the preferred
@@ -66,7 +66,10 @@
 		 * 
 		 * This implementation returns <code>false</code>, subclasses can override.
 		 * 
-		 * @return <code>true</code> if the pattern should match only whole words
+		 * @return <code>true</code> if the pattern should match only whole words. <code>true</code>
+		 *         is not allowed if {@link #isRegExSearch()} returns <code>true</code>. In this
+		 *         case, clients can either ignore this option or throw an
+		 *         {@link IllegalArgumentException}.
 		 * @since 3.9
 		 */
 		public boolean isWholeWordSearch() {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
index 4f7f859..8ea2512 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
@@ -9,9 +9,10 @@
  *     Markus Schorn - initial API and implementation
  *     Christian Walther (Indel AG) - Bug 399094: Add whole word option to file search
  *******************************************************************************/
-
 package org.eclipse.search2.internal.ui.text2;
 
+import org.eclipse.core.runtime.Assert;
+
 import org.eclipse.core.resources.IResource;
 
 import org.eclipse.ui.IWorkingSet;
@@ -21,6 +22,7 @@
 import org.eclipse.search.ui.text.FileTextSearchScope;
 import org.eclipse.search.ui.text.TextSearchQueryProvider;
 
+
 public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider {
 
 	/* (non-Javadoc)
@@ -32,6 +34,7 @@
 		boolean regEx= input.isRegExSearch();
 		boolean caseSensitive= input.isCaseSensitiveSearch();
 		boolean wholeWord= input.isWholeWordSearch();
+		Assert.isLegal(!(wholeWord && regEx));
 		return new FileSearchQuery(text, regEx, caseSensitive, wholeWord, scope);
 	}