package com.intellij.structuralsearch;

import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.structuralsearch.plugin.ui.Configuration;
import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
import org.jetbrains.annotations.NonNls;

public class PredefinedConfigurationUtil {

  public static Configuration createSearchTemplateInfo(String name, @NonNls String criteria, String category) {
    return createSearchTemplateInfo(name, criteria, category, StdFileTypes.JAVA);
  }

  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);
    config.getMatchOptions().setSearchPattern(criteria);
    config.getMatchOptions().setFileType(fileType);
    MatcherImplUtil.transform( config.getMatchOptions() );

    return config;
  }

  public static Configuration createSearchTemplateInfoSimple(String name, @NonNls String criteria, String category) {
    final Configuration info = createSearchTemplateInfo(name,criteria,category);
    info.getMatchOptions().setRecursiveSearch(false);

    return info;
  }
}

@@ -37,75 +37,8 @@
 h;%0A%0A
-import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;%0A
 impo
@@ -133,16 +133,83 @@
 eTypes;%0A
+import com.intellij.structuralsearch.impl.matcher.MatcherImplUtil;%0A
 import c
@@ -903,24 +903,53 @@
 tegory);%0A   
+ final MatchOptions options =
  config.getM
@@ -957,24 +957,37 @@
 tchOptions()
+;%0A    options
 .setSearchPa
@@ -1011,32 +1011,15 @@
     
-config.getMatchO
+o
 ptions
-()
 .set
@@ -1034,24 +1034,65 @@
 (fileType);%0A
+    options.setCaseSensitiveMatch(true);%0A
     MatcherI
@@ -1113,34 +1113,15 @@
 orm(
- config.getMatchO
+o
 ptions
-() 
 );%0A%0A

enable case sensitive search for all predefined patterns (IDEA-149019)