SSR: don't enable "apply constraint within type hierarchy" when not searching java
authorBas Leijdekkers <basleijdekkers@gmail.com>
Wed, 25 Feb 2015 07:33:43 +0000 (08:33 +0100)
committerBas Leijdekkers <basleijdekkers@gmail.com>
Wed, 25 Feb 2015 10:47:09 +0000 (11:47 +0100)
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SearchDialog.java

index 2e408cab6f29abd6f10c37a90597a162bbdb1a41..52c2bffd7ed0ce294a4ceb610f4221bc17f1918d 100644 (file)
@@ -94,7 +94,7 @@ class EditVarConstraintsDialog extends DialogWrapper {
 
   private static Project myProject;
 
-  EditVarConstraintsDialog(final Project project,SearchModel _model,List<Variable> _variables, boolean replaceContext, FileType fileType) {
+  EditVarConstraintsDialog(final Project project, SearchModel _model, List<Variable> _variables, final FileType fileType) {
     super(project, false);
 
     variables = _variables;
@@ -102,7 +102,13 @@ class EditVarConstraintsDialog extends DialogWrapper {
 
     setTitle(SSRBundle.message("editvarcontraints.edit.variables"));
 
-    regexp.getDocument().addDocumentListener(new MyDocumentListener(notRegexp, applyWithinTypeHierarchy, wholeWordsOnly));
+    regexp.getDocument().addDocumentListener(new MyDocumentListener(notRegexp, wholeWordsOnly));
+    regexp.getDocument().addDocumentListener(new DocumentAdapter() {
+      @Override
+      public void documentChanged(DocumentEvent e) {
+        applyWithinTypeHierarchy.setEnabled(e.getDocument().getTextLength() > 0 && fileType == StdFileTypes.JAVA);
+      }
+    });
     read.addChangeListener(new MyChangeListener(notRead, false));
     write.addChangeListener(new MyChangeListener(notWrite, false));
     regexprForExprType.getDocument().addDocumentListener(new MyDocumentListener(exprTypeWithinHierarchy, notExprType));
index 4fe8b7d2201defd5cd796d61163b204da86e1b1d..ed5fd8e1b5c2885f0a2490eb7754dbb3ec611a05 100644 (file)
@@ -649,7 +649,6 @@ public class SearchDialog extends DialogWrapper {
             new EditVarConstraintsDialog(
               searchContext.getProject(),
               model, getVariablesFromListeners(),
-              isReplaceDialog(),
               (FileType)fileTypes.getSelectedItem()
             ).show();
             initiateValidation();