Repository: intellij-rust/intellij-rust
Issue: Cargo tool window will not be opened in CLion after plugin is enabled 

## Environment

* **IntelliJ Rust plugin version:** 0.4.167.4457-221-nightly
* **Rust toolchain version:** 1.59.0-nightly (0b42deacc 2021-12-09) x86_64-apple-darwin
* **IDE name and version:** CLion 2022.1 EAP (CL-221.4842)
* **Operating system:** macOS 11.5.1
* **Macro expansion engine:** new
* **Name resolution engine:** new

## Problem description
Cargo tool window will not be opened in CLion after plugin is enabled via `Create New Project` wizard

## Steps to reproduce

1. Install plugin on CLion
2. Disable plugin and restart the IDE
3. Click on `New Project` button -> `Create New Project` wizard is opened
4. Choose Rust
5. Click on `Enable plugin` button and create Rust project

## Expected Results
The project is successfully opened

## Actual Results:
Cargo tool window is not opened, exception is shown

<details>
    <summary>
    Exception
    </summary>

```
Unable to initialize Cargo tool window

java.lang.IllegalStateException: You must not register toolwindow programmatically so early. Rework code or use ToolWindowManager.invokeLater
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.getToolWindowPaneIfInitialized(ToolWindowManagerImpl.kt:490)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindow$intellij_platform_ide_impl(ToolWindowManagerImpl.kt:466)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindow(ToolWindowManagerImpl.kt:452)
	at org.rust.cargo.project.toolwindow.CargoToolWindow$Companion.initializeToolWindow(CargoToolWindow.kt:152)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.lambda-3$lambda-2$lambda-1$lambda-0(CargoProjectImpl.kt:103)
	at com.intellij.util.ModalityUiUtil.invokeLaterIfNeeded(ModalityUiUtil.java:30)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.lambda-3$lambda-2$lambda-1(CargoProjectImpl.kt:102)
	at com.intellij.ide.startup.impl.StartupManagerImpl.runAfterOpened(StartupManagerImpl.kt:455)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.lambda-3$lambda-2(CargoProjectImpl.kt:101)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:617)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:417)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:391)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:373)
	at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:34)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:180)
	at com.sun.proxy.$Proxy111.cargoProjectsUpdated(Unknown Source)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl$modifyProjects$1$1$invoke$$inlined$runWriteAction$1.compute(actions.kt:84)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$13(ApplicationImpl.java:1024)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1024)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl$modifyProjects$1$1.invoke(CargoProjectImpl.kt:635)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl$modifyProjects$1$1.invoke(CargoProjectImpl.kt:329)
	at com.intellij.openapi.application.ActionsKt.invokeAndWaitIfNeeded(actions.kt:29)
	at com.intellij.openapi.application.ActionsKt.invokeAndWaitIfNeeded$default(actions.kt:26)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.modifyProjects$lambda-9(CargoProjectImpl.kt:329)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:680)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:658)
	at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2094)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.modifyProjects(CargoProjectImpl.kt:328)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl.refreshAllProjects(CargoProjectImpl.kt:214)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl$1$1.invoke(CargoProjectImpl.kt:88)
	at org.rust.cargo.project.model.impl.CargoProjectsServiceImpl$1$1.invoke(CargoProjectImpl.kt:86)
	at org.rust.cargo.project.model.impl.CargoTomlWatcher.after(CargoTomlWatcher.kt:37)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:617)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:417)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:391)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:373)
	at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:34)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:173)
	at com.sun.proxy.$Proxy109.beforePsiChanged(Unknown Source)
	at com.intellij.psi.impl.PsiManagerImpl.beforeChange(PsiManagerImpl.java:422)
	at com.intellij.psi.impl.PsiManagerImpl.beforePropertyChange(PsiManagerImpl.java:245)
	at com.intellij.psi.impl.file.impl.FileManagerImpl.firePropertyChangedForUnloadedPsi(FileManagerImpl.java:148)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.handleVfsChangeWithoutPsi(PsiVFSListener.java:710)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.lambda$fileCreated$0(PsiVFSListener.java:163)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1015)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.fileCreated(PsiVFSListener.java:159)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.fireForGrouped(PsiVFSListener.java:776)
	at one.util.streamex.CollapseSpliterator.lambda$forEachRemaining$0(CollapseSpliterator.java:133)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at one.util.streamex.CollapseSpliterator.forEachRemaining(CollapseSpliterator.java:129)
	at one.util.streamex.AbstractStreamEx.forEach(AbstractStreamEx.java:351)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.groupAndFire(PsiVFSListener.java:753)
	at com.intellij.psi.impl.file.impl.PsiVFSListener.after(PsiVFSListener.java:742)
	at com.intellij.psi.impl.file.impl.PsiVFSListener$1.after(PsiVFSListener.java:147)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
	at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:617)
	at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:417)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:391)
	at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:373)
	at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:34)
	at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:180)
	at com.sun.proxy.$Proxy86.after(Unknown Source)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.fireAfterEvents(PersistentFSImpl.java:1219)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.applyMultipleEvents(PersistentFSImpl.java:1198)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.processEventsImpl(PersistentFSImpl.java:1161)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.processEventsFromRefresh(AsyncEventSupport.java:150)
	at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.fireEventsInWriteAction(RefreshSessionImpl.java:226)
	at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.lambda$fireEvents$1(RefreshSessionImpl.java:205)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runEdtProgressWriteAction$9(ApplicationImpl.java:979)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.util.PotemkinProgress.runInSwingThread(PotemkinProgress.java:164)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runEdtProgressWriteAction$10(ApplicationImpl.java:979)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runEdtProgressWriteAction(ApplicationImpl.java:977)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithNonCancellableProgressInDispatchThread(ApplicationImpl.java:958)
	at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.lambda$fireEvents$2(RefreshSessionImpl.java:199)
	at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:86)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1029)
	at com.intellij.openapi.application.WriteAction.run(WriteAction.java:85)
	at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.fireEvents(RefreshSessionImpl.java:198)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.lambda$runAsyncListeners$9(RefreshQueueImpl.java:148)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$safeTransferToEdt$6(NonBlockingReadActionImpl.java:596)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:215)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:197)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:943)
	at com.intellij.openapi.progress.util.ProgressWindow.lambda$startBlocking$4(ProgressWindow.java:205)
	at com.intellij.openapi.application.impl.ApplicationImpl.runUnlockingIntendedWrite(ApplicationImpl.java:899)
	at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:201)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$execFromEDT$6(ProgressRunner.java:321)
	at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:753)
	at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731)
	at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2108)
	at com.intellij.openapi.progress.impl.ProgressRunner.execFromEDT(ProgressRunner.java:318)
	at com.intellij.openapi.progress.impl.ProgressRunner.submit(ProgressRunner.java:259)
	at com.intellij.openapi.progress.impl.ProgressRunner.submitAndGet(ProgressRunner.java:185)
	at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:477)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:537)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:266)
	at org.rust.openapiext.UtilsKt.computeWithCancelableProgress(utils.kt:272)
	at org.rust.ide.newProject.RsDirectoryProjectGenerator.generateProject(RsDirectoryProjectGenerator.kt:48)
	at org.rust.ide.newProject.RsDirectoryProjectGenerator.generateProject(RsDirectoryProjectGenerator.kt:28)
	at com.intellij.clion.rust.helper.CLionRustStubProjectGenerator.generateProject(CLionRustStubProjectGenerator.kt:79)
	at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.doGenerateProject(AbstractNewProjectStep.java:242)
	at com.intellij.ide.util.projectWizard.AbstractNewProjectStep.doGenerateProject(AbstractNewProjectStep.java:195)
	at com.intellij.ide.util.projectWizard.AbstractNewProjectStep$AbstractCallback.consume(AbstractNewProjectStep.java:183)
	at com.intellij.ide.util.projectWizard.ProjectSettingsStepBase$1.actionPerformed(ProjectSettingsStepBase.java:144)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6654)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
	at java.desktop/java.awt.Component.processEvent(Component.java:6419)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5029)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2790)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4861)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:119)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```

 </details>

Changed files:
src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt

diff --git a/src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt b/src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt
index bf1439256..ef70214d0 100644
--- a/src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt
+++ b/src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt
@@ -10,7 +10,6 @@ import com.intellij.execution.RunManager
 import com.intellij.ide.impl.isTrusted
 import com.intellij.notification.NotificationType
 import com.intellij.openapi.Disposable
-import com.intellij.openapi.application.ModalityState
 import com.intellij.openapi.application.invokeAndWaitIfNeeded
 import com.intellij.openapi.application.invokeLater
 import com.intellij.openapi.application.runWriteAction
@@ -32,8 +31,8 @@ import com.intellij.openapi.util.io.FileUtil
 import com.intellij.openapi.vfs.LocalFileSystem
 import com.intellij.openapi.vfs.VirtualFile
 import com.intellij.openapi.vfs.VirtualFileManager
+import com.intellij.openapi.wm.ToolWindowManager
 import com.intellij.psi.PsiManager
-import com.intellij.util.ModalityUiUtil
 import com.intellij.util.indexing.LightDirectoryIndex
 import com.intellij.util.io.exists
 import com.intellij.util.io.systemIndependentPath
@@ -99,7 +98,8 @@ open class CargoProjectsServiceImpl(
 
             subscribe(CargoProjectsService.CARGO_PROJECTS_TOPIC, CargoProjectsListener { _, _ ->
                 StartupManager.getInstance(project).runAfterOpened {
-                    ModalityUiUtil.invokeLaterIfNeeded(ModalityState.NON_MODAL) {
+                    // TODO: provide a proper solution instead of using `invokeLater`
+                    ToolWindowManager.getInstance(project).invokeLater {
                         initializeToolWindow(project)
                     }
                 }