Fix empty spaces in Structure View tree while indexing is in progress (dumb mode on)

This commit is contained in:
Sergey Malenkov
2016-06-29 19:54:11 +03:00
parent 01aa6a91a4
commit 20a2b0c121
2 changed files with 11 additions and 5 deletions
@@ -20,6 +20,7 @@ import com.intellij.navigation.ColoredItemPresentation;
import com.intellij.navigation.LocationPresentation;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -104,7 +105,12 @@ public abstract class JavaClassTreeElementBase<Value extends PsiElement> extends
@Override
public TextAttributesKey getTextAttributesKey() {
return isDeprecated() ? CodeInsightColors.DEPRECATED_ATTRIBUTES : null;
try {
return isDeprecated() ? CodeInsightColors.DEPRECATED_ATTRIBUTES : null;
}
catch (IndexNotReadyException ignore) {
return null; // do not show deprecated elements while indexing
}
}
private boolean isDeprecated(){
@@ -939,7 +939,7 @@ public class AbstractTreeUi {
return update.get();
}
catch (IndexNotReadyException e) {
warnOnIndexNotReady();
warnOnIndexNotReady(e);
return false;
}
}
@@ -1619,7 +1619,7 @@ public class AbstractTreeUi {
});
}
catch (IndexNotReadyException e) {
warnOnIndexNotReady();
warnOnIndexNotReady(e);
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
finally {
@@ -1651,10 +1651,10 @@ public class AbstractTreeUi {
return passOne.get();
}
private void warnOnIndexNotReady() {
private void warnOnIndexNotReady(IndexNotReadyException e) {
if (!myWasEverIndexNotReady) {
myWasEverIndexNotReady = true;
LOG.warn("Tree is not dumb-mode-aware; treeBuilder=" + getBuilder() + " treeStructure=" + getTreeStructure());
LOG.error("Tree is not dumb-mode-aware; treeBuilder=" + getBuilder() + " treeStructure=" + getTreeStructure(), e);
}
}