564946: Replace use of org.eclipse.ui.internal.misc.StringMatcher

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=564946

Change-Id: I264d95e2e3e354f34829c2acfdbf33bcf1bff32e
Signed-off-by: Frank Becker <eclipse@frank-becker.de>
diff --git a/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickContextPopupDialog.java b/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickContextPopupDialog.java
index 51c8bf7..f1b9ee2 100644
--- a/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickContextPopupDialog.java
+++ b/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickContextPopupDialog.java
@@ -1,10 +1,10 @@
 /*******************************************************************************
  *  Copyright (c) 2006, 2011 IBM Corporation and others.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0 which is available at
  * https://www.eclipse.org/legal/epl-2.0
- * 
+ *
  * SPDX-License-Identifier: EPL-2.0
  *
  *     IBM Corporation - initial API and implementation
@@ -50,16 +50,16 @@
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.misc.StringMatcher;
+import org.eclipse.ui.dialogs.SearchPattern;
 import org.eclipse.ui.navigator.CommonViewer;
 
 /**
  * Derived from {@link QuickOutlinePopupDialog}.
- * 
+ *
  * @author Mik Kersten
  */
-public class QuickContextPopupDialog extends PopupDialog implements IInformationControl, IInformationControlExtension,
-		IInformationControlExtension2, DisposeListener {
+public class QuickContextPopupDialog extends PopupDialog
+		implements IInformationControl, IInformationControlExtension, IInformationControlExtension2, DisposeListener {
 
 	public static final String ID_VIEWER = "org.eclipse.mylyn.context.ui.navigator.context.quick"; //$NON-NLS-1$
 
@@ -69,7 +69,7 @@
 
 	private Text fFilterText;
 
-	private StringMatcher fStringMatcher;
+	private SearchPattern fStringMatcher;
 
 	private QuickOutlinePatternAndInterestFilter namePatternFilter;
 
@@ -246,7 +246,7 @@
 		 * computed in Window#getInitialLocation, which will center it in the parent shell / main
 		 * monitor, which is wrong for two reasons:
 		 * - we want to center over the editor / subject control, not the parent shell
-		 * - the center is computed via the initalSize, which may be also wrong since the size may 
+		 * - the center is computed via the initalSize, which may be also wrong since the size may
 		 *   have been updated since via min/max sizing of AbstractInformationControlManager.
 		 * In that case, override the location with the one computed by the manager. Note that
 		 * the call to constrainShellSize in PopupDialog.open will still ensure that the shell is
@@ -320,7 +320,7 @@
 	private void createUIWidgetFilterText(Composite parent) {
 		// Create the widget
 		fFilterText = new Text(parent, SWT.NONE);
-		// Set the font 
+		// Set the font
 		GC gc = new GC(parent);
 		gc.setFont(parent.getFont());
 		FontMetrics fontMetrics = gc.getFontMetrics();
@@ -334,7 +334,7 @@
 	}
 
 	/**
-	 * 
+	 *
 	 */
 	private void gotoSelectedElement() {
 		Object selectedElement = getSelectedElement();
@@ -394,7 +394,7 @@
 	 * <p>
 	 * The following characters have special meaning: ? => any character * => any string
 	 * </p>
-	 * 
+	 *
 	 * @param pattern
 	 *            the pattern
 	 * @param update
@@ -404,7 +404,8 @@
 		if (pattern.length() == 0) {
 			fStringMatcher = null;
 		} else {
-			fStringMatcher = new StringMatcher(pattern, true, false);
+			fStringMatcher = new SearchPattern(SearchPattern.RULE_PATTERN_MATCH);
+			fStringMatcher.setPattern(pattern);
 		}
 		// Update the name pattern filter on the tree viewer
 		namePatternFilter.setStringMatcher(fStringMatcher);
@@ -457,7 +458,7 @@
 			// Return the element if it matches the pattern
 			if (element != null) {
 				String label = labelProvider.getText(element);
-				if (fStringMatcher.match(label)) {
+				if (fStringMatcher.matches(label)) {
 					return element;
 				}
 			}
diff --git a/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickOutlinePatternAndInterestFilter.java b/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickOutlinePatternAndInterestFilter.java
index 83e5a83..673ab3a 100644
--- a/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickOutlinePatternAndInterestFilter.java
+++ b/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/views/QuickOutlinePatternAndInterestFilter.java
@@ -1,10 +1,10 @@
 /*******************************************************************************
  * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0 which is available at
  * https://www.eclipse.org/legal/epl-2.0
- * 
+ *
  * SPDX-License-Identifier: EPL-2.0
  *
  *     Tasktop Technologies - initial API and implementation
@@ -18,18 +18,18 @@
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.mylyn.context.ui.InterestFilter;
-import org.eclipse.ui.internal.misc.StringMatcher;
+import org.eclipse.ui.dialogs.SearchPattern;
 
 /**
  * Derived from {@link QuickOutlinePatternAndInterestFilter}
- * 
+ *
  * @author Mik Kersten
  */
 public class QuickOutlinePatternAndInterestFilter extends ViewerFilter {
 
 	private final InterestFilter interestFilter = new InterestFilter();
 
-	private StringMatcher stringMatcher;
+	private SearchPattern stringMatcher;
 
 	public QuickOutlinePatternAndInterestFilter() {
 		stringMatcher = null;
@@ -51,7 +51,7 @@
 			// Match the pattern against the label of the given element
 			String matchName = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element);
 			// Element passes the filter if it matches the pattern
-			if ((matchName != null) && stringMatcher.match(matchName)) {
+			if ((matchName != null) && stringMatcher.matches(matchName)) {
 				return true;
 			}
 			// Determine whether the element has children that pass the filter
@@ -79,7 +79,7 @@
 		return false;
 	}
 
-	public void setStringMatcher(StringMatcher stringMatcher) {
+	public void setStringMatcher(SearchPattern stringMatcher) {
 		this.stringMatcher = stringMatcher;
 	}