show implementations in background: inherit found elements from first modal search

This commit is contained in:
anna
2011-08-31 16:53:44 +02:00
parent d8fd368e0b
commit 95885cb953
2 changed files with 9 additions and 3 deletions
@@ -81,10 +81,14 @@ public class GotoImplementationHandler extends GotoTargetHandler {
@Override
public void run(@NotNull ProgressIndicator indicator) {
super.run(indicator);
for (PsiElement element : myGotoData.targets) {
updateComponent(element, createComparator(renderers, myGotoData));
}
new ImplementationSearcher.BackgroundableImplementationSearcher() {
protected void processElement(PsiElement element) {
myGotoData.addTarget(element);
updateComponent(element, createComparator(renderers, myGotoData));
if (myGotoData.addTarget(element)) {
updateComponent(element, createComparator(renderers, myGotoData));
}
}
}.searchImplementations(myEditor, myGotoData.source, myOffset);
}
@@ -278,7 +278,8 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
return hasDifferentNames;
}
public void addTarget(final PsiElement element) {
public boolean addTarget(final PsiElement element) {
if (ArrayUtil.find(targets, element) > -1) return false;
targets = ArrayUtil.append(targets, element);
renderers.put(element, createRenderer(this, element));
if (!hasDifferentNames && element instanceof PsiNamedElement) {
@@ -291,6 +292,7 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
myNames.add(name);
hasDifferentNames = myNames.size() > 1;
}
return true;
}
public PsiElementListCellRenderer getRenderer(Object value) {