String (FileChooserDescriptor descriptor, @Nullable Project project, @Nullable VirtualFile toSelect) { String last = (project != null ? PropertiesComponent.getInstance(project) : PropertiesComponent.getInstance()).getValue(LAST_OPENED_FILE); if (last != null && (toSelect == null || descriptor.getUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT) == Boolean.TRUE)) { return last; } if (toSelect != null) { return toSelect.getPath(); } if (project != null && !project.isDefault()) { VirtualFile projectDir = ProjectUtil.guessProjectDir(project); if (projectDir != null) { return projectDir.getPath(); } } return SystemProperties.getUserHome(); }