本文整理匯總了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;
}
示例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);
}
示例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);
}