void (Runnable action) { PsiReferenceRegistrarImpl referenceProvidersRegistry = (PsiReferenceRegistrarImpl)ReferenceProvidersRegistry.getInstance().getRegistrar(JavaLanguage.INSTANCE); PsiReferenceProvider fileReferenceProvider = new FilePathReferenceProvider(); try { referenceProvidersRegistry.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class), fileReferenceProvider); getPsiManager().dropPsiCaches(); action.run(); } finally { referenceProvidersRegistry.unregisterReferenceProvider(PsiLiteralExpression.class, fileReferenceProvider); } }