当前位置: 首页>>代码示例>>Java>>正文


Java StringMatcher类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.ui.util.StringMatcher的典型用法代码示例。如果您正苦于以下问题:Java StringMatcher类的具体用法?Java StringMatcher怎么用?Java StringMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringMatcher类属于org.eclipse.jdt.internal.ui.util包,在下文中一共展示了StringMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStringMatchers

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
private synchronized StringMatcher[] getStringMatchers() {
  if (fStringMatchers == null) {
    String str =
        ""; // PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.TYPEFILTER_ENABLED);
    StringTokenizer tok = new StringTokenizer(str, ";"); // $NON-NLS-1$
    int nTokens = tok.countTokens();

    fStringMatchers = new StringMatcher[nTokens];
    for (int i = 0; i < nTokens; i++) {
      String curr = tok.nextToken();
      if (curr.length() > 0) {
        fStringMatchers[i] = new StringMatcher(curr, false, false);
      }
    }
  }
  return fStringMatchers;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:TypeFilter.java

示例2: getIgnoreFilters

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
 * Returns filters for packages which should not be included in the search results.
 *
 * @return StringMatcher[]
 */
private StringMatcher[] getIgnoreFilters() {
    if (fFilters == null) {
        String filterString = null;

        if (isFilterEnabled()) {
            filterString = getFilters();

            if (filterString == null) {
                filterString = DEFAULT_IGNORE_FILTERS;
            }
        }

        if (filterString != null) {
            fFilters = parseList(filterString);
        } else {
            fFilters = null;
        }
    }

    return fFilters;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CallHierarchy.java

示例3: getStringMatchers

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
private synchronized StringMatcher[] getStringMatchers() {
	if (fStringMatchers == null) {
		String str= PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.TYPEFILTER_ENABLED);
		StringTokenizer tok= new StringTokenizer(str, ";"); //$NON-NLS-1$
		int nTokens= tok.countTokens();

		fStringMatchers= new StringMatcher[nTokens];
		for (int i= 0; i < nTokens; i++) {
			String curr= tok.nextToken();
			if (curr.length() > 0) {
				fStringMatchers[i]= new StringMatcher(curr, false, false);
			}
		}
	}
	return fStringMatchers;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:TypeFilter.java

示例4: setPattern

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
@Override
public void setPattern(String patternString) {
	super.setPattern(patternString);
	fMatchers= null;
	if (patternString != null && patternString.length() > 0) {
		ArrayList<StringMatcher> res= new ArrayList<StringMatcher>();
		StringTokenizer tok= new StringTokenizer(patternString, ",;"); //$NON-NLS-1$
		int tokenCount= tok.countTokens();
		for (int i= 0; i < tokenCount; i++) {
			String token= tok.nextToken();
			if (token.length() > 0) {
				res.add(new StringMatcher(token + '*', true, false));
			}
		}
		if (!res.isEmpty()) {
			fMatchers= res.toArray(new StringMatcher[res.size()]);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:FilteredElementTreeSelectionDialog.java

示例5: match

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
private boolean match(PreferenceTreeNode node, StringMatcher labelMatcher, StringMatcher valueMatcher) {
	if (node.getKey() == null) {
		return false;
	}
	boolean valueMatched= true;
	boolean labelMatched= true;
	if (labelMatcher != null) {
		labelMatched= labelMatcher.match(node.getLabel());
	}
	if (valueMatcher != null) {
		if (node.getControlType() == PreferenceTreeNode.COMBO) {
			valueMatched= valueMatcher.match(fConfigBlock.getComboBox(node.getKey()).getText());
		} else if (node.getControlType() == PreferenceTreeNode.CHECKBOX) {
			boolean checked= fConfigBlock.getCheckBox(node.getKey()).getSelection();
			if (checked) {
				valueMatched= valueMatcher.match(PreferencesMessages.OptionsConfigurationBlock_On) || valueMatcher.match(PreferencesMessages.OptionsConfigurationBlock_Enabled);
			} else {
				valueMatched= valueMatcher.match(PreferencesMessages.OptionsConfigurationBlock_Off) || valueMatcher.match(PreferencesMessages.OptionsConfigurationBlock_Disabled);
			}
		}
	}
	return labelMatched && valueMatched;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:OptionsConfigurationBlock.java

示例6: filter

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
 * @param fullTypeName fully-qualified type name
 * @return <code>true</code> iff the given type is filtered out
 */
public boolean filter(String fullTypeName) {
  StringMatcher[] matchers = getStringMatchers();
  for (int i = 0; i < matchers.length; i++) {
    StringMatcher curr = matchers[i];
    if (curr.match(fullTypeName)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:TypeFilter.java

示例7: getLongestCommonSubstring

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
 * Returns the longest common substring of two strings.
 *
 * @param first the first string
 * @param second the second string
 * @return the longest common substring
 */
private static String getLongestCommonSubstring(String first, String second) {

  String shorter = (first.length() <= second.length()) ? first : second;
  String longer = shorter == first ? second : first;

  int minLength = shorter.length();

  StringBuffer pattern = new StringBuffer(shorter.length() + 2);
  String longestCommonSubstring = ""; // $NON-NLS-1$

  for (int i = 0; i < minLength; i++) {
    for (int j = i + 1; j <= minLength; j++) {
      if (j - i < longestCommonSubstring.length()) continue;

      String substring = shorter.substring(i, j);
      pattern.setLength(0);
      pattern.append('*');
      pattern.append(substring);
      pattern.append('*');

      StringMatcher matcher = new StringMatcher(pattern.toString(), true, false);
      if (matcher.match(longer)) longestCommonSubstring = substring;
    }
  }

  return longestCommonSubstring;
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:ParameterGuesser.java

示例8: parseList

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
* Parses the comma separated string into an array of {@link StringMatcher} objects.
*
* @param listString the string to parse
* @return an array of {@link StringMatcher} objects
*/
  private static StringMatcher[] parseList(String listString) {
      List<StringMatcher> list = new ArrayList<StringMatcher>(10);
      StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$

      while (tokenizer.hasMoreTokens()) {
          String textFilter = tokenizer.nextToken().trim();
          list.add(new StringMatcher(textFilter, false, false));
      }

      return list.toArray(new StringMatcher[list.size()]);
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:CallHierarchy.java

示例9: filter

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
 * @param fullTypeName fully-qualified type name
 * @return <code>true</code> iff the given type is filtered out
 */
public boolean filter(String fullTypeName) {
	StringMatcher[] matchers= getStringMatchers();
	for (int i= 0; i < matchers.length; i++) {
		StringMatcher curr= matchers[i];
		if (curr.match(fullTypeName)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:TypeFilter.java

示例10: getLongestCommonSubstring

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
/**
 * Returns the longest common substring of two strings.
 *
 * @param first the first string
 * @param second the second string
 * @return the longest common substring
 */
private static String getLongestCommonSubstring(String first, String second) {

	String shorter= (first.length() <= second.length()) ? first : second;
	String longer= shorter == first ? second : first;

	int minLength= shorter.length();

	StringBuffer pattern= new StringBuffer(shorter.length() + 2);
	String longestCommonSubstring= ""; //$NON-NLS-1$

	for (int i= 0; i < minLength; i++) {
		for (int j= i + 1; j <= minLength; j++) {
			if (j - i < longestCommonSubstring.length())
				continue;

			String substring= shorter.substring(i, j);
			pattern.setLength(0);
			pattern.append('*');
			pattern.append(substring);
			pattern.append('*');

			StringMatcher matcher= new StringMatcher(pattern.toString(), true, false);
			if (matcher.match(longer))
				longestCommonSubstring= substring;
		}
	}

	return longestCommonSubstring;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:ParameterGuesser.java

示例11: JavaElementPrefixPatternMatcher

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
public JavaElementPrefixPatternMatcher(String pattern) {
	int elementNameEnd= findNameEnd(pattern);

	String elementName= pattern.substring(0, elementNameEnd);
	String rest= pattern.substring(elementNameEnd);

	if (rest.startsWith(STAR)) {
		elementNameEnd= 0;
		rest= pattern;
	}
	fElementNamePattern= elementNameEnd == 0 ? null : new PatternMatcher(elementName);
	
	boolean ignoreCase= rest.toLowerCase().equals(rest);
	fRestPattern= new StringMatcher(rest + STAR, ignoreCase, false);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JavaElementPrefixPatternMatcher.java

示例12: filter

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
public boolean filter(PreferenceTreeNode node, StringMatcher labelMatcher, StringMatcher valueMatcher) {
	//check this node
	boolean visible= match(node, labelMatcher, valueMatcher);
	if (visible) {
		if (valueMatcher != null && !node.hasValue()) { //see bug 321818
			labelMatcher= null;
			visible= false;
		} else {
			node.setVisible(visible, true);
			fMatchFound= true;
			return visible;
		}
	}
	//check children
	List<PreferenceTreeNode> children= node.getChildren();
	if (children != null) {
		for (int i= 0; i < children.size(); i++) {
			visible|= filter(children.get(i), labelMatcher, valueMatcher);
		}
		if (node.isShowAllChildren()) {
			for (int i= 0; i < children.size(); i++) {
				children.get(i).setVisible(visible, false);
			}
		}
	}
	node.setVisible(visible, false);
	return visible;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:OptionsConfigurationBlock.java

示例13: doFilter

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
public void doFilter(String filterText) {
	fRefreshJob.cancel();
	fRefreshJob.schedule(getRefreshJobDelay());
	filterText= filterText.trim();
	int index= filterText.indexOf("~"); //$NON-NLS-1$
	StringMatcher labelMatcher= null;
	StringMatcher valueMatcher= null;
	if (index == -1) {
		labelMatcher= createStringMatcher(filterText);
	} else {
		if (index == 0) {
			int i= 0;
			for (; i < filterText.length(); i++) {
				char ch= filterText.charAt(i);
				if (ch == ' ' || ch == '\t') {
					break;
				}
			}
			valueMatcher= createStringMatcher(filterText.substring(1, i));
			labelMatcher= createStringMatcher(filterText.substring(i));
		} else {
			labelMatcher= createStringMatcher(filterText.substring(0, index));
			if (index < filterText.length())
				valueMatcher= createStringMatcher(filterText.substring(index + 1));
		}
	}
	fMatchFound= false;
	filter(fRoot, labelMatcher, valueMatcher);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:OptionsConfigurationBlock.java

示例14: select

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
	if (fMatchers.length == 0) {
		return true;
	}
	String matchName= null;
	if (element instanceof IJavaElement) {
		matchName= ((IJavaElement) element).getElementName();
	} else if (element instanceof IResource) {
		matchName= ((IResource) element).getName();
	} else if (element instanceof IStorage) {
		matchName= ((IStorage) element).getName();
	} else if (element instanceof IWorkingSet) {
		matchName= ((IWorkingSet) element).getLabel();
	} else if (element instanceof IAdaptable) {
		IWorkbenchAdapter wbadapter= (IWorkbenchAdapter) ((IAdaptable)element).getAdapter(IWorkbenchAdapter.class);
		if (wbadapter != null) {
			matchName= wbadapter.getLabel(element);
		}
	}
	if (matchName != null && matchName.length() > 0) {
		StringMatcher[] testMatchers= getMatchers();
		for (int i = 0; i < testMatchers.length; i++) {
			if (testMatchers[i].match(matchName))
				return false;
		}
		return true;
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:NamePatternFilter.java

示例15: filter

import org.eclipse.jdt.internal.ui.util.StringMatcher; //导入依赖的package包/类
public boolean filter(String fullTypeName) {
	StringMatcher[] matchers= getStringMatchers();
	for (int i= 0; i < matchers.length; i++) {
		StringMatcher curr= matchers[i];
		if (curr.match(fullTypeName)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:11,代码来源:TypeFilter.java


注:本文中的org.eclipse.jdt.internal.ui.util.StringMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。