How can i separate thread?

im makeing a plugin project with several modules....

 

I used a MessageBus to communicate with modules each other.

 

But when receive some message from other module, i tried,

 

ProjectView.getInstance(project).select(null, virtualFile, true);


But this is not work with an exception...

[ 126049]  ERROR - plication.impl.ApplicationImpl - Access is allowed from event dispatch thread only.

 

How can i refresh project view in that thread?

 

I tried like:

ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    public void run() {
        ApplicationManager.getApplication().runReadAction(new Runnable() {
             public void run() {
                   VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(folderToCreate);
                   ProjectView.getInstance(project).select(null, virtualFile, true);
             }
        });
    }
});

But this is not work................T_T


 

Please sign in to leave a comment.