@Override
  protected synchronized void initialize() {
    PsiDirectory psiElement = ObjectUtils.tryCast(getPsiElement(), PsiDirectory.class);
    LOG.assertTrue(psiElement != null);
    if (!ProjectRootsUtil.isSourceRoot(psiElement)) {
      final PsiDirectory parentDirectory = psiElement.getParentDirectory();
      if (parentDirectory != null && ProjectFileIndex.getInstance(psiElement.getProject()).isInSourceContent(parentDirectory.getVirtualFile())) {
        final WritableRefElement refElement = (WritableRefElement)getRefManager().getReference(parentDirectory);
        if (refElement != null) {
          refElement.add(this);
          return;
        }
      }
    }
    myRefModule = getRefManager().getRefModule(ModuleUtilCore.findModuleForPsiElement(psiElement));
    if (myRefModule != null) {
      ((WritableRefEntity)myRefModule).add(this);
      return;
    }
    ((WritableRefEntity)myManager.getRefProject()).add(this);
  }
@Override
  protected synchronized void initialize()