Rfresh ToolWindow

I am writing my first plugin and am a bit stuck!

I have a ToolWindow object that contains some real-time data. If I resize the ToolWindow I see the data changing but if I leave it alone, the data stays static.

How can I "force" the ToolWindow to refresh from code?

Thanks in advance,
Alex

5 comments

Hello Alex,

A> I am writing my first plugin and am a bit stuck!
A>
A> I have a ToolWindow object that contains some real-time data. If I
A> resize the ToolWindow I see the data changing but if I leave it
A> alone, the data stays static.
A>
A> How can I "force" the ToolWindow to refresh from code?

JComponent.repaint()

This isn't really related to the IDEA OpenAPI...

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Thanks for the fast reply - yes this works.

You are right it's not really related to the API...

However I am getting the following from the API when calling repaint().


java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:51)
at com.intellij.openapi.application.impl.ApplicationImpl.f(ApplicationImpl.java:87)
at com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread(ApplicationImpl.java:107)
at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.getToolWindow(ToolWindowManagerImpl.java:135)

0

Hello Alex,

You need to use SwingUtilities.invokeLater() if you do the call from a thread
other than the Swing event dispatch thread.

A> Thanks for the fast reply - yes this works.
A>
A> You are right it's not really related to the API...
A>
A> However I am getting the following from the API when calling
A> repaint().
A>
A> java.lang.Throwable
A> at com.intellij.openapi.diagnostic.Logger.error(Logger.java:51)
A> at
A> com.intellij.openapi.application.impl.ApplicationImpl.f(ApplicationIm
A> pl.java:87)
A> at
A> com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatc
A> hThread(ApplicationImpl.java:107)
A> at
A> com.intellij.openapi.wm.impl.ToolWindowManagerImpl.getToolWindow(Tool
A> WindowManagerImpl.java:135)
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

And also this further down:

ERROR - plication.impl.ApplicationImpl - Access is allowed from event dispatch thread only.
Details: Current thread: Thread[JSFC Event Thread 0,6,Idea Thread Group] 26501254
Our dispatch thread:Thread[AWT-EventQueue-1,6,Idea Thread Group] 27951681
SystemEventQueueThread: Thread[AWT-EventQueue-1,6,Idea Thread Group] 27951681

ERROR - plication.impl.ApplicationImpl - IntelliJ IDEA 5.1 Build #4155
ERROR - plication.impl.ApplicationImpl - JDK: 1.5.0_06
ERROR - plication.impl.ApplicationImpl - VM: Java HotSpot(TM) Client VM
ERROR - plication.impl.ApplicationImpl - Vendor: Sun Microsystems Inc.
ERROR - plication.impl.ApplicationImpl - OS: Windows XP
ERROR - plication.impl.ApplicationImpl - Last Action:
ERROR - plication.impl.ApplicationImpl - Access is allowed from event dispatch thread only.
Details: Current thread: Thread[JSFC Event Thread 0,6,Idea Thread Group] 26501254
Our dispatch thread:Thread[AWT-EventQueue-1,6,Idea Thread Group] 27951681
SystemEventQueueThread: Thread[AWT-EventQueue-1,6,Idea Thread Group] 27951681

0

Yes - you are right!

The call was coming from a different thread!

Thank you.

0

Please sign in to leave a comment.