[vcs-log] apply text filter on focus change only when it has some unsaved changes
authorJulia Beliaeva <Julia.Beliaeva@jetbrains.com>
Mon, 7 Nov 2016 15:58:05 +0000 (18:58 +0300)
committerJulia Beliaeva <Julia.Beliaeva@jetbrains.com>
Mon, 7 Nov 2016 15:58:21 +0000 (18:58 +0300)
IDEA-146772

platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java

index cc55c0c37029670d38eebc3a039386b6f63ec7a1..672c14f98a481c9b881f53c4083531ad16aa186e 100644 (file)
@@ -267,6 +267,11 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
       myText = text;
     }
 
+    boolean hasUnsavedChanges() {
+      if (myText == null) return false;
+      return getFilter() == null || !myText.equals(getFilter().getText());
+    }
+
     @Override
     void setFilter(@Nullable VcsLogTextFilter filter) {
       super.setFilter(filter);
@@ -464,7 +469,9 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
 
     @Override
     protected void onFocusLost() {
-      applyFilter();
+      if (myTextFilterModel.hasUnsavedChanges()) {
+        applyFilter();
+      }
     }
   }
 }