void (final PsiFile psiFile) { final VirtualFile virtualFile = psiFile.getVirtualFile(); assert virtualFile != null; final FileChooserDescriptor descriptor = new AnyXMLDescriptor(true) { @Override public boolean isFileSelectable(@Nullable VirtualFile file) { return super.isFileSelectable(file) && !file.equals(virtualFile); } }; final VirtualFile[] virtualFiles = FileChooser.chooseFiles(descriptor, psiFile.getProject(), psiFile.getVirtualFile()); for (VirtualFile file : virtualFiles) { assert !virtualFile.equals(file); myManager.addAssociation(psiFile, file); } }