use of org.rstudio.studio.client.workbench.views.source.model.SourceDocument in project rstudio by rstudio.
the class Source method openFileFromServer.
private void openFileFromServer(final FileSystemItem file, final TextFileType fileType, final ResultCallback<EditingTarget, ServerError> resultCallback) {
final Command dismissProgress = globalDisplay_.showProgress("Opening file...");
server_.openDocument(file.getPath(), fileType.getTypeId(), uiPrefs_.defaultEncoding().getValue(), new ServerRequestCallback<SourceDocument>() {
@Override
public void onError(ServerError error) {
dismissProgress.execute();
pMruList_.get().remove(file.getPath());
Debug.logError(error);
if (resultCallback != null)
resultCallback.onFailure(error);
}
@Override
public void onResponseReceived(SourceDocument document) {
dismissProgress.execute();
pMruList_.get().add(document.getPath());
EditingTarget target = addTab(document, OPEN_INTERACTIVE);
if (resultCallback != null)
resultCallback.onSuccess(target);
}
});
}
Aggregations