當前位置: 首頁>>代碼示例>>Java>>正文


Java PatternConstructor類代碼示例

本文整理匯總了Java中org.eclipse.search.internal.core.text.PatternConstructor的典型用法代碼示例。如果您正苦於以下問題:Java PatternConstructor類的具體用法?Java PatternConstructor怎麽用?Java PatternConstructor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PatternConstructor類屬於org.eclipse.search.internal.core.text包,在下文中一共展示了PatternConstructor類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validateRegex

import org.eclipse.search.internal.core.text.PatternConstructor; //導入依賴的package包/類
private boolean validateRegex() {
  if (fIsRegExCheckbox.getSelection()) {
    try {
      PatternConstructor.createPattern(fPattern.getText(), fIsCaseSensitive, true);
    } catch (PatternSyntaxException e) {
      String locMessage = e.getLocalizedMessage();
      int i = 0;
      while (i < locMessage.length() && "\n\r".indexOf(locMessage.charAt(i)) == -1) { //$NON-NLS-1$
        i++;
      }
      statusMessage(true, locMessage.substring(0, i)); // only take first line
      return false;
    }
    statusMessage(false, ""); //$NON-NLS-1$
  } else {
    statusMessage(false, "(* = any string, ? = any character, \\ = escape for literals: * ? \\)");
  }
  return true;
}
 
開發者ID:GoClipse,項目名稱:goclipse,代碼行數:20,代碼來源:GoSearchPage.java

示例2: createPattern

import org.eclipse.search.internal.core.text.PatternConstructor; //導入依賴的package包/類
/**
 * Creates a pattern for the given search string and the given options.
 *
 * @param pattern the search pattern. If <code>isRegex</code> is:
 *     <ul>
 *       <li><code>false</code>: a string including '*' and '?' wildcards and '\' for escaping the
 *           literals '*', '?' and '\'
 *       <li><code>true</code>: a regex as specified by {@link Pattern} plus "\R" denoting a line
 *           delimiter (platform independent)
 *     </ul>
 *
 * @param isRegex <code>true</code> if the given string follows the {@link Pattern} including "\R"
 * @param isCaseSensitive Set to <code>true</code> to create a case insensitive pattern
 * @return the created pattern
 * @throws PatternSyntaxException if "\R" is at an illegal position
 * @see Pattern
 * @since 3.8
 */
public static Pattern createPattern(String pattern, boolean isCaseSensitive, boolean isRegex)
    throws PatternSyntaxException {
  return PatternConstructor.createPattern(pattern, isRegex, true, isCaseSensitive, false);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:23,代碼來源:TextSearchEngine.java

示例3: createSearchPattern

import org.eclipse.search.internal.core.text.PatternConstructor; //導入依賴的package包/類
/**
 * Create a default search pattern taking into consideration case sensitivity and regular expression settings
 * 
 * @return
 */
public Pattern createSearchPattern()
{
	return PatternConstructor.createPattern(searchText.getText(), lastCaseSensitiveState, lastRegularExpressionState);
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:10,代碼來源:SearchComposite.java


注:本文中的org.eclipse.search.internal.core.text.PatternConstructor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。