Assertion failed: Access is allowed from event dispatch thread only.

I am developing a plugin for IDEA. I am adding my UI as ToolWindow. My UI has a toolbar. Sometimes while enabling/disabling toolbar buttons I get the following error. How can I fix the problem? Am I missing something?

ERROR - plication.impl.ApplicationImpl - Assertion failed: Access is
allowed from event dispatch thread only.
ERROR - plication.impl.ApplicationImpl - IntelliJ IDEA 4.0 Build #11
65
ERROR - plication.impl.ApplicationImpl - JDK: 1.4.2_03
ERROR - plication.impl.ApplicationImpl - VM: Java HotSpot(TM) Client
VM
ERROR - plication.impl.ApplicationImpl - Vendor: Sun Microsystems Inc
.
ERROR - plication.impl.ApplicationImpl - OS: Windows 2000
ERROR - plication.impl.ApplicationImpl - Assertion failed: Access is
allowed from event dispatch thread only.
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:138)
at com.intellij.openapi.application.a.b.assertIsDispatchThread(b.java:18)
at com.intellij.ui.TabbedPaneWrapper.getSelectedComponent(TabbedPaneWrapper.java:75)
at com.intellij.ui.TabbedPaneWrapper$_MyFocusTraversalPolicy.getDefaultComponent(TabbedPaneWrapper.java:5)
at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:129)
at javax.swing.SortingFocusTraversalPolicy.getComponentAfter(SortingFocusTraversalPolicy.java:200)
at javax.swing.LayoutFocusTraversalPolicy.getComponentAfter(LayoutFocusTraversalPolicy.java:85)
at java.awt.Component.nextFocusHelper(Component.java:6244)
at java.awt.Container.nextFocusHelper(Container.java:2466)
at java.awt.Component.nextFocus(Component.java:6227)
at java.awt.Component.transferFocus(Component.java:6180)
at java.awt.Component.doAutoTransfer(Component.java:6169)
at java.awt.Component.autoTransferFocus(Component.java:6147)
at java.awt.Component.disable(Component.java:1007)
at javax.swing.JComponent.disable(JComponent.java:3017)
at java.awt.Component.enable(Component.java:989)
at java.awt.Component.setEnabled(Component.java:954)
at javax.swing.JComponent.setEnabled(JComponent.java:2247)
at javax.swing.AbstractButton.setEnabled(AbstractButton.java:1867)

Please sign in to leave a comment.