本文整理汇总了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);
}