From e24ed670aecbde5603ca82976d61fd0949272f88 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 8 Oct 2010 14:55:56 +0400 Subject: [PATCH] optimization --- .../uiDesigner/binding/FormReferencesSearcher.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferencesSearcher.java b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferencesSearcher.java index aa67c104b0b8..0ad32e0a2294 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferencesSearcher.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormReferencesSearcher.java @@ -230,11 +230,14 @@ public class FormReferencesSearcher implements QueryExecutor fileSet = new HashSet(); ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { - ContainerUtil - .addAll(fileSet, manager.getCacheManager().getFilesWithWord(words.get(0), UsageSearchContext.IN_PLAIN_TEXT, scope, true)); + PsiFile[] filesWithWord = manager.getCacheManager().getFilesWithWord(words.get(0), UsageSearchContext.IN_PLAIN_TEXT, scope, true); + ContainerUtil.addAll(fileSet, filesWithWord); for (int i = 1; i < words.size(); i++) { - fileSet.retainAll( - Arrays.asList(manager.getCacheManager().getFilesWithWord(words.get(i), UsageSearchContext.IN_PLAIN_TEXT, scope, true))); + ProgressManager.checkCanceled(); + String word = words.get(i); + PsiFile[] filesWithThisWord = manager.getCacheManager().getFilesWithWord(word, UsageSearchContext.IN_PLAIN_TEXT, scope, true); + fileSet.retainAll(Arrays.asList(filesWithThisWord)); + if (fileSet.isEmpty()) break; } } });