IDEA-CR-62240 ensure that EP is not loaded without a reason

GitOrigin-RevId: e3b06098d5a212c231f9d4e73d12772f23680f7d
This commit is contained in:
Vladimir Krivosheev
2020-05-04 09:19:55 +00:00
committed by intellij-monorepo-bot
parent 6c423b03a6
commit d1d229a88c
@@ -102,7 +102,7 @@ class WindowInfoImpl : Cloneable, WindowInfo, BaseState() {
override val isDocked: Boolean
get() = type == ToolWindowType.DOCKED
fun normalizeAfterRead() {
internal fun normalizeAfterRead() {
setTypeAndCheck(type)
if (isVisible && id != null && !canActivateOnStart(id!!)) {
@@ -150,14 +150,12 @@ private class ToolWindowAnchorConverter : Converter<ToolWindowAnchor>() {
}
private fun canActivateOnStart(id: String): Boolean {
for (ep in listOf(
ToolWindowEP.EP_NAME.extensionList,
FacetDependentToolWindow.EXTENSION_POINT_NAME.extensionList,
LibraryDependentToolWindow.EXTENSION_POINT_NAME.extensionList).flatten()
) {
if (id == ep.id) {
return !ep.isDoNotActivateOnStart
}
}
return true
val ep = findEp(ToolWindowEP.EP_NAME.iterable, id)
?: findEp(FacetDependentToolWindow.EXTENSION_POINT_NAME.iterable, id)
?: findEp(LibraryDependentToolWindow.EXTENSION_POINT_NAME.iterable, id)
return ep == null || !ep.isDoNotActivateOnStart
}
private fun findEp(list: Iterable<ToolWindowEP>, id: String): ToolWindowEP? {
return list.firstOrNull { id == it.id }
}