Tool windows: use ToolWindow.remove instead of deprecated ToolWindowManagerEx.unregisterToolWindow

GitOrigin-RevId: 5e2945843a4115a4480c0bc6ac86164f249675d0
This commit is contained in:
Yuriy Artamonov
2019-12-18 15:34:12 +00:00
committed by intellij-monorepo-bot
parent 20e3cc86ad
commit 28fcadd5e3
2 changed files with 7 additions and 4 deletions
@@ -47,7 +47,7 @@ final class FacetDependentToolWindowManager implements ProjectComponent {
return;
}
}
toolWindowManager.unregisterToolWindow(extension.id);
toolWindow.remove();
}
}
}
@@ -13,6 +13,7 @@ import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.openapi.wm.ext.LibraryDependentToolWindow;
import com.intellij.openapi.wm.ext.LibrarySearchHelper;
import com.intellij.util.concurrency.SequentialTaskExecutor;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBusConnection;
@@ -54,7 +55,10 @@ public class LibraryDependentToolWindowManager implements StartupActivity {
List<LibraryDependentToolWindow> extensions = LibraryDependentToolWindow.EXTENSION_POINT_NAME.getExtensionList();
ReadAction
.nonBlocking(() -> new HashSet<>(ContainerUtil.findAll(extensions, ltw -> ltw.getLibrarySearchHelper().isLibraryExists(project))))
.nonBlocking(() -> new HashSet<>(ContainerUtil.findAll(extensions, ltw -> {
LibrarySearchHelper helper = ltw.getLibrarySearchHelper();
return helper != null && helper.isLibraryExists(project);
})))
.inSmartMode(project)
.coalesceBy(this)
.finishOnUiThread(currentModalityState, existing -> {
@@ -68,12 +72,11 @@ public class LibraryDependentToolWindowManager implements StartupActivity {
}
else {
if (toolWindow != null) {
toolWindowManagerEx.unregisterToolWindow(libraryToolWindow.id);
toolWindow.remove();
}
}
}
})
.submit(ourExecutor);
}
}