Jetpack Compose for Desktop and plugin

Answered

Hi,

 

I'm trying add ComposePanel into toolWindowContent like this:

contentManager.addContent(
ContentFactory.SERVICE.getInstance().createContent(
createMainPanel(),
null,
true
)
)
private fun createMainPanel(): JComponent {

return ComposePanel().apply {
setContent {

DropDownComponent()
.dropdown(topics) { topic -> listener.onTopicChanged(topic) }
if (topics.value.isNotEmpty()) {
listener.onTopicChanged(topics.value.first())
}
}
}
}

Unfortunate it report exception :

2021-06-16 22:34:36,268 [ 12705] ERROR - llij.ide.plugins.PluginManager - Could not initialize class kotlinx.coroutines.CoroutineExceptionHandlerImplKt
java.lang.NoClassDefFoundError: Could not initialize class kotlinx.coroutines.CoroutineExceptionHandlerImplKt
at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:33)
at kotlinx.coroutines.DispatchedTask.handleFatalException(DispatchedTask.kt:146)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:115)
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:893)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:762)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:438)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:825)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:437)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:793)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:489)
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)

 

Any idea what the issue is (I guess Im trying update/add UI component from wrong thread but how to fix it)

0
2 comments

I also checked example for Compose how to use it with plugin for IntelliJ and what noticed when I used that inside ToolWindow it repaint content only when ToolWindow is close and open again.

 

0

Please note that CFD is still under heavy development, so issues should be expected and filed against Compose GitHub project.

 

Please share your full plugin sources,

0

Please sign in to leave a comment.