Description
Groovy plugins using registerToolWindow fail on LivePlugin 0.9.8 beta. Tested on GoLand 2025.2.5. Works fine in 0.9.7beta on GoLand 2025.2.1
Error
groovy.lang.MissingPropertyException: No such property: instance for class: com.intellij.ui.content.ContentFactoryImpl at liveplugin.implementation.ToolWindows.registerToolWindowIn(ToolWindows.groovy:103)
Root Cause
In src/plugin-api-groovy/liveplugin/implementation/ToolWindows.groovy on line 103, we have:
ContentFactory.getInstance().instance.createContent(...)
This is a double property access - getInstance() returns the ContentFactory, then .instance tries to access a non-existent property on it.
Kotlin API works
The Kotlin API (registerIdeToolWindow / registerProjectToolWindow) does not have this issue and works correctly.
Workaround for Groovy
I've been able to work around this in groovy by calling the IntelliJ APIs directly for now, which I think confirms the above issue being the cause.
Use the IntelliJ API directly instead of registerToolWindow:
import com.intellij.openapi.wm.RegisterToolWindowTask
import com.intellij.openapi.wm.ToolWindowAnchor
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.ui.content.ContentFactory
def twManager = ToolWindowManager.getInstance(project)
def existingTw = twManager.getToolWindow("My Tool Window")
if (existingTw != null) {
twManager.unregisterToolWindow("My Tool Window")
}
def toolWindow = twManager.registerToolWindow(
RegisterToolWindowTask.notClosable("My Tool Window", ToolWindowAnchor.RIGHT)
)
def content = ContentFactory.getInstance().createContent(
myPanel, "", false
)
toolWindow.contentManager.addContent(content)
Environment
- LivePlugin: 0.9.8 beta
- IDE: GoLand 2025.2.5
- OS: macOS
Description
Groovy plugins using registerToolWindow fail on LivePlugin
0.9.8 beta. Tested on GoLand2025.2.5. Works fine in0.9.7betaon GoLand2025.2.1Error
groovy.lang.MissingPropertyException: No such property: instance for class: com.intellij.ui.content.ContentFactoryImpl at liveplugin.implementation.ToolWindows.registerToolWindowIn(ToolWindows.groovy:103)Root Cause
In
src/plugin-api-groovy/liveplugin/implementation/ToolWindows.groovyon line 103, we have:ContentFactory.getInstance().instance.createContent(...)
This is a double property access - getInstance() returns the ContentFactory, then .instance tries to access a non-existent property on it.
Kotlin API works
The Kotlin API (
registerIdeToolWindow/registerProjectToolWindow) does not have this issue and works correctly.Workaround for Groovy
I've been able to work around this in groovy by calling the IntelliJ APIs directly for now, which I think confirms the above issue being the cause.
Use the IntelliJ API directly instead of registerToolWindow:
Environment