Search in sources :

Example 1 with SearchConfiguration

use of com.intellij.structuralsearch.plugin.ui.SearchConfiguration in project intellij-community by JetBrains.

the class SSRCodeInsightTest method doTest.

private void doTest(final String searchPattern, final String patternName) {
    final SearchConfiguration configuration = new SearchConfiguration();
    //display name
    configuration.setName(patternName);
    //search pattern
    final MatchOptions options = new MatchOptions();
    options.setFileType(StdFileTypes.JAVA);
    options.setSearchPattern(searchPattern);
    configuration.setMatchOptions(options);
    myInspection.setConfigurations(Collections.<Configuration>singletonList(configuration), myFixture.getProject());
    myFixture.testHighlighting(true, false, false, getTestName(false) + ".java");
}
Also used : SearchConfiguration(com.intellij.structuralsearch.plugin.ui.SearchConfiguration)

Example 2 with SearchConfiguration

use of com.intellij.structuralsearch.plugin.ui.SearchConfiguration in project intellij-community by JetBrains.

the class SSBasedInspectionTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    SSBasedInspection inspection = new SSBasedInspection();
    List<Configuration> configurations = new ArrayList<>();
    SearchConfiguration configuration = new SearchConfiguration();
    MatchOptions options = new MatchOptions();
    options.setFileType(StdFileTypes.JAVA);
    options.setSearchPattern("int i;");
    configuration.setMatchOptions(options);
    configurations.add(configuration);
    configuration = new SearchConfiguration();
    options = new MatchOptions();
    options.setFileType(StdFileTypes.JAVA);
    options.setSearchPattern("f();");
    configuration.setMatchOptions(options);
    configurations.add(configuration);
    inspection.setConfigurations(configurations, myProject);
    myWrapper = new LocalInspectionToolWrapper(inspection);
}
Also used : Configuration(com.intellij.structuralsearch.plugin.ui.Configuration) SearchConfiguration(com.intellij.structuralsearch.plugin.ui.SearchConfiguration) ArrayList(java.util.ArrayList) SSBasedInspection(com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection) SearchConfiguration(com.intellij.structuralsearch.plugin.ui.SearchConfiguration) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper)

Example 3 with SearchConfiguration

use of com.intellij.structuralsearch.plugin.ui.SearchConfiguration in project intellij-community by JetBrains.

the class PredefinedConfigurationUtil method createSearchTemplateInfo.

public static Configuration createSearchTemplateInfo(String name, @NonNls String criteria, String category, FileType fileType) {
    final SearchConfiguration config = new SearchConfiguration();
    config.setPredefined(true);
    config.setName(name);
    config.setCategory(category);
    final MatchOptions options = config.getMatchOptions();
    options.setSearchPattern(criteria);
    options.setFileType(fileType);
    options.setCaseSensitiveMatch(true);
    MatcherImplUtil.transform(options);
    return config;
}
Also used : SearchConfiguration(com.intellij.structuralsearch.plugin.ui.SearchConfiguration)

Aggregations

SearchConfiguration (com.intellij.structuralsearch.plugin.ui.SearchConfiguration)3 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)1 SSBasedInspection (com.intellij.structuralsearch.inspection.highlightTemplate.SSBasedInspection)1 Configuration (com.intellij.structuralsearch.plugin.ui.Configuration)1 ArrayList (java.util.ArrayList)1