dkandalov / live-plugin

IntelliJ plugin for writing IntelliJ plugins at runtime ⚡️
https://plugins.jetbrains.com/plugin/7282
Apache License 2.0
858 stars 67 forks source link

Having plugin enabled in Android Studio Electric Eel Beta 1 prevents project from opening #147

Closed matejdro closed 2 years ago

matejdro commented 2 years ago

When plugin is installed and I attempt to open any project, project will start loading and then, shortly after, I will be dumped back to the project list screen. This exception pops up in the logs:

java.lang.RuntimeException: java.lang.IllegalStateException: You must not register toolwindow programmatically so early. Rework code or use ToolWindowManager.invokeLater
    at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:119)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:503)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:523)
    at com.intellij.openapi.project.impl.ProjectManagerExImplKt.openProject(ProjectManagerExImpl.kt:591)
    at com.intellij.openapi.project.impl.ProjectManagerExImplKt.access$openProject(ProjectManagerExImpl.kt:1)
    at com.intellij.openapi.project.impl.ProjectManagerExImpl$doOpenAsync$1.invoke(ProjectManagerExImpl.kt:145)
    at com.intellij.openapi.project.impl.ProjectManagerExImpl$doOpenAsync$1.invoke(ProjectManagerExImpl.kt:56)
    at com.intellij.openapi.project.impl.ProjectUiFrameAllocator$run$progressRunner$1.apply(ProjectFrameAllocator.kt:96)
    at com.intellij.openapi.project.impl.ProjectUiFrameAllocator$run$progressRunner$1.apply(ProjectFrameAllocator.kt:72)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
    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.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: 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.registerToolWindow(ToolWindowManagerImpl.kt:928)
    at com.intellij.execution.ui.RunContentManagerImpl.registerToolWindow(RunContentManagerImpl.kt:150)
    at com.intellij.execution.ui.RunContentManagerImpl.getOrCreateContentManagerForToolWindow(RunContentManagerImpl.kt:398)
    at com.intellij.execution.ui.RunContentManagerImpl.getContentManagerForRunner(RunContentManagerImpl.kt:382)
    at com.intellij.execution.ui.RunContentManagerImpl.showRunContent(RunContentManagerImpl.kt:256)
    at com.intellij.execution.ui.RunContentManagerImpl.showRunContent(RunContentManagerImpl.kt:248)
    at liveplugin.implementation.common.IdeUtil$showInConsole$runnable$1.invoke(ide-util.kt:107)
    at liveplugin.implementation.common.IdeUtil$showInConsole$runnable$1.invoke(ide-util.kt:92)
    at liveplugin.implementation.common.IdeUtil.showInConsole$lambda-2(ide-util.kt:109)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:490)
    at liveplugin.implementation.common.IdeUtil.showInConsole(ide-util.kt:109)
    at liveplugin.implementation.common.IdeUtil.displayError(ide-util.kt:67)
    at liveplugin.implementation.actions.RunPluginActionsKt.displayError(RunPluginActions.kt:192)
    at liveplugin.implementation.actions.RunPluginActionsKt.runWith(RunPluginActions.kt:120)
    at liveplugin.implementation.actions.RunPluginActionsKt.access$runWith(RunPluginActions.kt:1)
    at liveplugin.implementation.actions.RunPluginAction$Companion.runPlugins(RunPluginActions.kt:60)
    at liveplugin.implementation.LivePluginProjectListener.projectOpened(LivePluginProjectListener.kt:35)
    at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
    at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:621)
    at com.intellij.util.messages.impl.MessageBusImpl.access$300(MessageBusImpl.java:34)
    at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.executeOrAddToQueue(MessageBusImpl.java:209)
    at com.intellij.util.messages.impl.CompositeMessageBus$ToDirectChildrenMessagePublisher.publish(CompositeMessageBus.java:105)
    at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:167)
    at com.sun.proxy.$Proxy119.projectOpened(Unknown Source)
    at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1$1.run(ProjectManagerExImpl.kt:605)
    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.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1.run(ProjectManagerExImpl.kt:460)
    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.LaterInvocator$1.run(LaterInvocator.java:96)
    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.project.impl.ProjectUiFrameAllocator.run(ProjectFrameAllocator.kt:118)
    at com.intellij.openapi.project.impl.ProjectManagerExImpl.doOpenAsync(ProjectManagerExImpl.kt:123)
    at com.intellij.openapi.project.impl.ProjectManagerExImpl.openProjectAsync(ProjectManagerExImpl.kt:110)
    at com.intellij.ide.RecentProjectsManagerBase.openProject(RecentProjectsManagerBase.kt:333)
    at com.intellij.ide.ReopenProjectAction.actionPerformed(ReopenProjectAction.java:71)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:235)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:256)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:235)
    at com.intellij.openapi.wm.impl.welcomeScreen.RecentProjectPanel.performSelectedAction(RecentProjectPanel.java:208)
    at com.intellij.openapi.wm.impl.welcomeScreen.RecentProjectPanel$1.onClick(RecentProjectPanel.java:116)
    at com.intellij.ui.ClickListener$1.mouseReleased(ClickListener.java:59)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
    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:2793)
    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:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

This is with:

Android Studio Electric Eel | 2022.1.1 Beta 1
Build #AI-221.6008.13.2211.9039819, built on September 8, 2022
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
LivePlugin 0.8.1 beta
dkandalov commented 2 years ago

I wasn't able to reproduce it with Electric Eel Beta 2 but I've seen this issue elsewhere. It should be fixed in LivePlugin version 0.8.2.

matejdro commented 2 years ago

Can confirm, works with 0.8.2 beta. Thanks!