void (LookupFile file) { String path = file.getAbsolutePath(); VirtualFile ioFile = VfsUtil.findFileByIoFile(new File(path), false); if (ioFile == null) { myTextField.setText(path); return; } String relativePath = VfsUtilCore.getRelativePath(ioFile, myProject.getBaseDir()); myTextField.setText(relativePath != null ? relativePath : path); }