About ProjectManager getDefaultProject!

My code is showed below. How can i prevent it to throw exception?


java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:66)
at com.intellij.openapi.application.b.b.assertIsDispatchThread(b.java:291)
at com.intellij.openapi.components.a.a.a(a.java:66)
at com.intellij.openapi.components.a.a.getComponent(a.java:212)
at com.intellij.openapi.components.a.a.o(a.java:36)
at com.intellij.openapi.components.a.a.j(a.java:185)
at com.intellij.openapi.project.a.c.u(c.java:82)
at com.intellij.openapi.project.a.d.u(d.java:208)
at com.intellij.openapi.project.a.b.getDefaultProject(b.java:7)

1 comment
Comment actions Permalink

On 1/15/04 6:56 AM, in article
28850290.1074138992519.JavaMail.itn@is.intellij.net, "andyfai"
<no_mail@jetbrains.com> wrote:

By running it in swing dispatch thread. Just like assertion message says.
Use SwingUtilities.invokeLater or invokeAndWait.

My code is showed below. How can i prevent it to throw exception?

 ApplicationManager.getApplication().runReadAction(new Runnable() {
> public void run() {
> ProjectManager.getInstance().getDefaultProject();
> }
> });
> ]]>


java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:66)
at com.intellij.openapi.application.b.b.assertIsDispatchThread(b.java:291)
at com.intellij.openapi.components.a.a.a(a.java:66)
at com.intellij.openapi.components.a.a.getComponent(a.java:212)
at com.intellij.openapi.components.a.a.o(a.java:36)
at com.intellij.openapi.components.a.a.j(a.java:185)
at com.intellij.openapi.project.a.c.u(c.java:82)
at com.intellij.openapi.project.a.d.u(d.java:208)
at com.intellij.openapi.project.a.b.getDefaultProject(b.java:7)


--
Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0

Please sign in to leave a comment.