[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-ui-dev] Faster Open-Type Dialog
|
Here is my "patch" for making the OpenTypeDialog faster. I assumed that
noone wants to search for a class with fewer chars than 2, or perform a
wildcard search with fewer chars than 3.
I do not know what is required to indicate "do not search" (null perhaps?),
so I currently use a bogus search string so that no hits are found.
private static class TypeFilterMatcher implements
FilteredList.FilterMatcher {
private StringMatcher fMatcher;
private StringMatcher fQualifierMatcher;
/*
* @see FilteredList.FilterMatcher#setFilter(String, boolean)
*/
public void setFilter(String pattern, boolean ignoreCase,
boolean igoreWildCards) {
+ if (pattern != null){
+ int content = 0;
+ boolean wildcard = false;
+ for (int i=0; i<pattern.length(); i++){
+ char ch = pattern.charAt(i);
+ if (ch == '*' || ch == '.' || ch == '?'){
+ wildcard = true;
+ continue;
+ }
+ content++;
+ }
+ if (content < 2 || wildcard && content < 3)
+ pattern = "xxxxx1111xxxxxx"; //$NON-NLS-1$
+ }
int qualifierIndex= pattern.lastIndexOf(".");
//$NON-NLS-1$