7111 : "Directory index is not initialized yet." Throwable

Hi, In a plugin I developped, when the plugin receives the projectOpened callback, it starts a background process which needs to know if particular files/directories are parts of the project.

Since the 7111 build, i get the following exception when calling the Project.getProjectScope().contains(VirtualFile) method

java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getInfoForDirectory(DirectoryIndexImpl.java:74)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.isInContent(ProjectFileIndexImpl.java:42)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.isInContent(ProjectFileIndexImpl.java:6)
at com.intellij.openapi.project.impl.ProjectImpl$3.contains(ProjectImpl.java:0)
at org.intellij.vcs.mks.realtime.SandboxCacheImpl.addSandboxPath(SandboxCacheImpl.java:62)
at org.intellij.vcs.mks.realtime.SandboxSynchronizer.handleLine(SandboxSynchronizer.java:42)
at org.intellij.vcs.mks.realtime.AbstractMKSSynchronizer.executeCommand(AbstractMKSSynchronizer.java:86)
at org.intellij.vcs.mks.realtime.AbstractMKSSynchronizer$1.run(AbstractMKSSynchronizer.java:35)
at java.lang.Thread.run(Thread.java:595)


I guess you would need to wait a bit more, which may be ok, but how can i know when the directory index will be used ?

2 comments
Comment actions Permalink

Hello Thibaut,

I guess you would need to wait a bit more, which may be ok, but how
can i know when the directory index will be used ?


Use StartupManager.registerPostStartupActivity().

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


0
Comment actions Permalink

thanks, will try that

0

Please sign in to leave a comment.