private PsiDirectory findOurSourceRoot(PsiFileSystemItem item) { for (VirtualFile sourceRoot : ModuleRootManager.getInstance(myIdeaModule).getSourceRoots()) { String rootPath = sourceRoot.toString(); String itemPath = item.getVirtualFile().toString(); if (itemPath.startsWith(rootPath)) { return PsiManager.getInstance(myIdeaModule.getProject()).findDirectory(sourceRoot); } } return null; }
@Override public String toString() { return getClass().getSimpleName() + ": " + file.toString(); }