Enable highlighting in suggestions for multi word queries

The highlighting in suggestions only works if the display string of the
suggestions contains the full query string. If the query contains
multiple words the suggestions may correspond only to the last word. In
this case the display strings do not contain the full query.

Having a protected method that provides the query pattern allows
subclasses to highlight suggestions in multi word queries by
overwriting this method.

Change-Id: I0f82ee6dbd49b3b1192d1f62f74849659d17e281
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java b/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
index 303bc5b..e2c576b 100644
--- a/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
+++ b/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
@@ -41,7 +41,7 @@
     onRequestSuggestions(request, new Callback() {
       public void onSuggestionsReady(final Request request,
           final Response response) {
-        final String qpat = "(" + escape(request.getQuery()) + ")";
+        final String qpat = getQueryPattern(request.getQuery());
         final boolean html = isHTML();
         final ArrayList<Suggestion> r = new ArrayList<Suggestion>();
         for (final Suggestion s : response.getSuggestions()) {
@@ -52,6 +52,10 @@
     });
   }
 
+  protected String getQueryPattern(final String query) {
+    return "(" + escape(query) + ")";
+  }
+
   /**
    * @return true if {@link SuggestOracle.Suggestion#getDisplayString()} returns
    *         HTML; false if the text must be escaped before evaluating in an