Source:
<code>public void showOpenProjectDialog( FileSystemContext fsContext, ProjectsServerOperations server, String defaultLocation, int defaultType, boolean showNewSession, final ProgressOperationWithInput<OpenProjectParams> onCompleted) { RStudioGinjector.INSTANCE.injectMembers(this); FileDialogs dialogs = RStudioGinjector.INSTANCE.getFileDialogs(); if (Desktop.isDesktop() || !RStudioGinjector.INSTANCE.getSession().getSessionInfo() .getMultiSession()) { dialogs.openFile( "Open Project", fsContext, FileSystemItem.createDir(defaultLocation), "R Projects (*.Rproj)", true, new ProgressOperationWithInput<FileSystemItem>() { @Override public void execute(FileSystemItem input, final ProgressIndicator indicator) { if (input.isDirectory()) { String rprojPath = input.completePath(input.getName() + ".Rproj"); input = FileSystemItem.createFile(rprojPath); } final FileSystemItem projFile = input; <START> server_.createProjectFile( <END> projFile.getPath(), new ServerRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean success) { onCompleted.execute(new OpenProjectParams(projFile, null, false), indicator); } @Override public void onError(ServerError error) { Debug.logError(error); } }); } }); } else { WebFileDialogs webDialogs = (WebFileDialogs)dialogs; webDialogs.openProject(fsContext, FileSystemItem.createDir(defaultLocation), defaultType, showNewSession, onCompleted); } }</code><technical_language>Do need create project file if user select a directory</technical_language>

Target:
public void showOpenProjectDialog( FileSystemContext fsContext, ProjectsServerOperations server, String defaultLocation, int defaultType, boolean showNewSession, final ProgressOperationWithInput<OpenProjectParams> onCompleted) { RStudioGinjector.INSTANCE.injectMembers(this); FileDialogs dialogs = RStudioGinjector.INSTANCE.getFileDialogs(); if (Desktop.isDesktop() || !RStudioGinjector.INSTANCE.getSession().getSessionInfo() .getMultiSession()) { dialogs.openFile( "Open Project", fsContext, FileSystemItem.createDir(defaultLocation), "R Projects (*.Rproj)", true, new ProgressOperationWithInput<FileSystemItem>() { @Override public void execute(FileSystemItem input, final ProgressIndicator indicator) { final CommandWithArg<FileSystemItem> onProjectFileReady = new CommandWithArg<FileSystemItem>() { @Override public void execute(FileSystemItem item) { onCompleted.execute( new OpenProjectParams(item, null, false), indicator); } }; if (input == null) return; if (input.isDirectory()) { final String rprojPath = input.completePath(input.getName() + ".Rproj"); final FileSystemItem rprojFile = FileSystemItem.createFile(rprojPath); server_.createProjectFile( rprojFile.getPath(), new ServerRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean success) { onProjectFileReady.execute(rprojFile); } @Override public void onError(ServerError error) { Debug.logError(error); onProjectFileReady.execute(rprojFile); } }); } else { onProjectFileReady.execute(input); } } }); } else { WebFileDialogs webDialogs = (WebFileDialogs)dialogs; webDialogs.openProject(fsContext, FileSystemItem.createDir(defaultLocation), defaultType, showNewSession, onCompleted); } }