@SuppressWarnings("restriction")
protected SearchPattern createStringPattern(String patternStr, int searchFor, int limitTo, int matchRule) {
IDLTKLanguageToolkit toolkit = DeeLanguageToolkit.getDefault();
SearchPattern pattern = SearchPattern.createPattern(patternStr, searchFor, limitTo, matchRule, toolkit);
if(pattern instanceof FieldPattern) {
FieldPattern fieldPattern = (FieldPattern) pattern;
// we may have to work arround a DLTK bug here
// -- we are still going to test this codepath, even though it's not accessible because of DLTK bug
char[] name = ((FieldPattern) pattern).name;
int lastIx = CharOperation.lastIndexOf('.', name);
if(lastIx != -1) {
// assume a problem occurred in DLTK where qualifiedName has not been split
char[] qualification = CharOperation.subarray(fieldPattern.name, 0, lastIx);
CharOperation.replace(qualification, '.', '$');
char[] simpleName = CharOperation.subarray(fieldPattern.name, lastIx+1, -1);
return new FieldPattern(fieldPattern.findDeclarations,
fieldPattern.findReferences, fieldPattern.findReferences,
simpleName, qualification, null,
null, null, matchRule, toolkit);
}