Search in sources :

Example 6 with MatchOptions

use of com.intellij.structuralsearch.MatchOptions in project intellij-community by JetBrains.

the class GuavaOptionalConversionUtil method simplifyParameterPattern.

static String simplifyParameterPattern(PsiMethodCallExpression methodCall) {
    final PsiExpressionList argumentList = methodCall.getArgumentList();
    final PsiExpression[] expressions = argumentList.getExpressions();
    if (expressions.length == 1) {
        final PsiExpression expression = expressions[0];
        Matcher matcher = new Matcher(methodCall.getProject());
        final MatchOptions options = new MatchOptions();
        options.setFileType(StdFileTypes.JAVA);
        final List<MatchResult> results = matcher.testFindMatches(expression.getText(), GuavaOptionalConversionRule.OPTIONAL_CONVERTOR_PATTERN, options, false);
        if (!results.isEmpty()) {
            final MatchResult result = results.get(0);
            if (result.getStart() == 0 && result.getEnd() == -1) {
                return GuavaOptionalConversionRule.OPTIONAL_CONVERTOR_PATTERN;
            }
        }
    }
    return "$o$";
}
Also used : Matcher(com.intellij.structuralsearch.Matcher) MatchOptions(com.intellij.structuralsearch.MatchOptions) MatchResult(com.intellij.structuralsearch.MatchResult)

Example 7 with MatchOptions

use of com.intellij.structuralsearch.MatchOptions in project intellij-community by JetBrains.

the class FindInFilesOptimizingSearchHelper method doAddSearchWordInLiterals.

protected void doAddSearchWordInLiterals(final String refname) {
    final MatchOptions options = context.getOptions();
    CacheManager.SERVICE.getInstance(myProject).processFilesWithWord(myFileProcessor, refname, UsageSearchContext.IN_STRINGS, (GlobalSearchScope) options.getScope(), options.isCaseSensitiveMatch());
}
Also used : MatchOptions(com.intellij.structuralsearch.MatchOptions)

Example 8 with MatchOptions

use of com.intellij.structuralsearch.MatchOptions in project intellij-community by JetBrains.

the class FindInFilesOptimizingSearchHelper method doAddSearchWordInComments.

protected void doAddSearchWordInComments(final String refname) {
    final MatchOptions options = context.getOptions();
    CacheManager.SERVICE.getInstance(myProject).processFilesWithWord(myFileProcessor, refname, UsageSearchContext.IN_COMMENTS, (GlobalSearchScope) options.getScope(), options.isCaseSensitiveMatch());
}
Also used : MatchOptions(com.intellij.structuralsearch.MatchOptions)

Aggregations

MatchOptions (com.intellij.structuralsearch.MatchOptions)8 ReplaceConfiguration (com.intellij.structuralsearch.plugin.replace.ui.ReplaceConfiguration)2 NotNull (org.jetbrains.annotations.NotNull)2 Project (com.intellij.openapi.project.Project)1 PsiExpression (com.intellij.psi.PsiExpression)1 MatchResult (com.intellij.structuralsearch.MatchResult)1 Matcher (com.intellij.structuralsearch.Matcher)1 ReplaceOptions (com.intellij.structuralsearch.plugin.replace.ReplaceOptions)1 Replacer (com.intellij.structuralsearch.plugin.replace.impl.Replacer)1