Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2013-03-12 16:25:44 +0000
committerDani Megert2013-03-12 16:25:44 +0000
commit3d4e3dbe167e3b75bf44aab5b252c8b4670a1fca (patch)
treef345ef20395f68d6b1931f97188cc64a68e01895
parent04c4ef15a4f0dc527eb24db5f114794e397fe7b5 (diff)
downloadeclipse.platform.text-I20130319-1000.tar.gz
eclipse.platform.text-I20130319-1000.tar.xz
eclipse.platform.text-I20130319-1000.zip
Polished fix for bug 402009: Whole word API and UI should not allow to be true if regex is trueN20130318-2000N20130317-2000N20130316-1500N20130315-2000I20130319-1000I20130314-1330I20130313-2000I20130313-0800I20130312-2000
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java7
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java5
2 files changed, 9 insertions, 3 deletions
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 810d56e1d..ea4246f48 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.ui.IWorkingSet;
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 @@ public abstract class TextSearchQueryProvider {
*
* 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 4f7f859e2..8ea251257 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.ISearchQuery;
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 @@ public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider {
boolean regEx= input.isRegExSearch();
boolean caseSensitive= input.isCaseSensitiveSearch();
boolean wholeWord= input.isWholeWordSearch();
+ Assert.isLegal(!(wholeWord && regEx));
return new FileSearchQuery(text, regEx, caseSensitive, wholeWord, scope);
}

Back to the top