blob: 0ea62c756f71cca0fbe511c44a168a4d288e10ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/*******************************************************************************
* Copyright (c) 2010 Mia-Software.
* 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:
* Nicolas Bros (Mia-Software)
*******************************************************************************/
package org.eclipse.papyrus.emf.facet.common.ui.internal.widgets;
import org.eclipse.papyrus.emf.facet.common.core.internal.utils.StringMatcher;
import org.eclipse.ui.dialogs.FilteredList.FilterMatcher;
/** This is a matcher that matches anywhere, not just at the beginning. */
public class AnywhereFilterMatcher implements FilterMatcher {
private StringMatcher fMatcher;
public void setFilter(final String pattern, final boolean ignoreCase,
final boolean ignoreWildCards) {
this.fMatcher = new StringMatcher('*' + pattern + '*', ignoreCase, ignoreWildCards);
}
public boolean match(final Object element) {
return this.fMatcher.match(element.toString());
}
}
|