sometimes the usage view component is invisible, re-fixes IDEA-169722 "Analyze dependencies" bottom tree is empty

This commit is contained in:
Alexey Kudravtsev
2017-03-20 13:40:45 +03:00
parent 13b4dce1ca
commit 0f40c5d1bc
2 changed files with 5 additions and 4 deletions
@@ -28,7 +28,6 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.psi.PsiElement;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.usages.impl.UsageViewImpl;
import com.intellij.util.Alarm;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -75,7 +74,6 @@ public abstract class UsagesPanel extends JPanel implements Disposable, DataProv
UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setCodeUsagesString(getCodeUsagesString());
myCurrentUsageView = UsageViewManager.getInstance(myProject).createUsageView(UsageTarget.EMPTY_ARRAY, usages, presentation, null);
((UsageViewImpl)myCurrentUsageView).expandAll();
setToComponent(myCurrentUsageView.getComponent());
}
catch (ProcessCanceledException e) {
@@ -249,7 +249,10 @@ public class UsageViewImpl implements UsageView {
toolWindowPanel.setContent(myCentralPanel);
myTree.setCellRenderer(myUsageViewTreeCellRenderer);
collapseAll();
SwingUtilities.invokeLater(() -> {
if (isDisposed || myProject.isDisposed()) return;
collapseAll();
});
myModelTracker.addListener(isPropertyChange-> {
if (!isPropertyChange) {
@@ -945,7 +948,7 @@ public class UsageViewImpl implements UsageView {
void expandRoot() {
ApplicationManager.getApplication().assertIsDispatchThread();
fireEvents();
myTree.expandPath(new TreePath(myTree.getModel().getRoot()));
TreeUtil.expand(myTree, 1);
}
@NotNull