use of org.rstudio.studio.client.server.ServerError in project rstudio by rstudio.
the class PackageActionConfirmationDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
FlowPanel flowPanel = new FlowPanel();
String explanatoryText = getExplanatoryText();
if (explanatoryText.length() > 0) {
Label text = new Label(explanatoryText);
text.setStylePrimaryName(RESOURCES.styles().explanatoryText());
flowPanel.add(text);
}
actionsTable_ = new CellTable<PendingAction>(15, GWT.<PackagesCellTableResources>create(PackagesCellTableResources.class));
actionsTable_.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
actionsTable_.setSelectionModel(new NoSelectionModel<PendingAction>());
actionsTable_.setWidth("100%", true);
ActionColumn actionColumn = new ActionColumn();
actionsTable_.addColumn(actionColumn);
actionsTable_.setColumnWidth(actionColumn, 30, Unit.PX);
addTableColumns(actionsTable_);
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setWidget(actionsTable_);
scrollPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
flowPanel.add(scrollPanel);
// query for updates
actionsDS_.requestData(new SimpleRequestCallback<JsArray<T>>() {
@Override
public void onResponseReceived(JsArray<T> actions) {
if (actions != null && actions.length() > 0) {
ArrayList<PendingAction> pendingActions = new ArrayList<PendingAction>();
for (int i = 0; i < actions.length(); i++) pendingActions.add(new PendingAction(actions.get(i), false));
actionsTable_.setPageSize(pendingActions.size());
actionsDataProvider_ = new ListDataProvider<PendingAction>();
actionsDataProvider_.setList(pendingActions);
actionsDataProvider_.addDataDisplay(actionsTable_);
enableCancelButton(true);
selectAllButton_.setEnabled(true);
selectNoneButton_.setEnabled(true);
} else {
closeDialog();
showNoActionsRequired();
}
}
@Override
public void onError(ServerError error) {
closeDialog();
super.onError(error);
}
});
return flowPanel;
}
use of org.rstudio.studio.client.server.ServerError in project rstudio by rstudio.
the class ImportFileSettingsDialog method loadData.
private void loadData() {
final Token invalidationToken = updateRequest_.getInvalidationToken();
progress_.onProgress("Detecting data format");
server_.getDataPreview(dataFile_.getPath(), new ServerRequestCallback<DataPreviewResult>() {
@Override
public void onResponseReceived(DataPreviewResult response) {
input_.setHTML(toInputHtml(response));
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
populateOutput(response);
if (response.hasHeader())
headingYes_.setValue(true);
else
headingNo_.setValue(true);
selectByValue(separator_, response.getSeparator());
selectByValue(decimal_, response.getDecimal());
selectByValue(quote_, response.getQuote());
selectByValue(comment_, response.getComment());
defaultStringsAsFactors_ = response.getDefaultStringsAsFactors();
stringsAsFactors_.setValue(defaultStringsAsFactors_);
}
@Override
public void onError(ServerError error) {
if (invalidationToken.isInvalid())
return;
progress_.onProgress(null);
globalDisplay_.showErrorMessage("Error", error.getUserMessage());
}
});
}
use of org.rstudio.studio.client.server.ServerError in project rstudio by rstudio.
the class LintManager method performCppLintServerRequest.
private void performCppLintServerRequest(final LintContext context) {
cppCompletionContext_.cppCompletionOperation(new CppCompletionOperation() {
@Override
public void execute(String docPath, int line, int column) {
server_.getCppDiagnostics(target_.getPath(), new ServerRequestCallback<JsArray<CppDiagnostic>>() {
@Override
public void onResponseReceived(JsArray<CppDiagnostic> diag) {
if (context.token.isInvalid())
return;
final JsArray<LintItem> cppLint = CppCompletionRequest.asLintArray(diag);
server_.lintRSourceDocument(target_.getId(), target_.getPath(), context.showMarkers, context.explicit, new ServerRequestCallback<JsArray<LintItem>>() {
@Override
public void onResponseReceived(JsArray<LintItem> rLint) {
if (context.token.isInvalid())
return;
JsArray<LintItem> allLint = JsArray.createArray().cast();
for (int i = 0; i < cppLint.length(); i++) allLint.push(cppLint.get(i));
for (int i = 0; i < rLint.length(); i++) allLint.push(rLint.get(i));
showLint(context, allLint);
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
});
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
});
}
});
}
use of org.rstudio.studio.client.server.ServerError in project rstudio by rstudio.
the class FilesUpload method completeFileUploadOperation.
private Operation completeFileUploadOperation(final FileUploadToken token, final boolean commit) {
return new Operation() {
public void execute() {
String msg = (commit ? "Completing" : "Cancelling") + " file upload...";
final Command dismissProgress = globalDisplay_.showProgress(msg);
server_.completeUpload(token, commit, new ServerRequestCallback<Void>() {
@Override
public void onResponseReceived(Void response) {
dismissProgress.execute();
}
@Override
public void onError(ServerError error) {
dismissProgress.execute();
globalDisplay_.showErrorMessage("File Upload Error", error.getUserMessage());
}
});
}
};
}
use of org.rstudio.studio.client.server.ServerError in project rstudio by rstudio.
the class RSConnectDeploy method populateDeploymentFiles.
private void populateDeploymentFiles(final ProgressIndicator indicator) {
if (source_ == null)
return;
// dependencies; just inject it directly into the list.
if (source_.isSelfContained() && source_.isStatic() && !source_.isWebsiteRmd()) {
ArrayList<String> files = new ArrayList<String>();
FileSystemItem selfContained = FileSystemItem.createFile(source_.getDeployFile());
files.add(selfContained.getName());
setFileList(files, null, null);
setPrimaryFile(selfContained.getName());
return;
}
// ternery operator maps to appropriate files to list for deployment:
// website code - website code directory
// static website - website build directory
// document - R Markdown document
// non-document - Shiny app directory
final String fileSource = source_.isDocument() ? source_.isWebsiteRmd() ? source_.isStatic() ? source_.getDeployDir() : source_.getWebsiteDir() : source_.getDeployFile() : source_.getDeployDir();
indicator.onProgress("Collecting files...");
server_.getDeploymentFiles(fileSource, asMultipleRmd_, new ServerRequestCallback<RSConnectDeploymentFiles>() {
@Override
public void onResponseReceived(RSConnectDeploymentFiles files) {
if (files.getDirSize() > files.getMaxSize()) {
indicator.onError("The item to be deployed (" + fileSource + ") " + "exceeds the maximum deployment size, which is " + StringUtil.formatFileSize(files.getMaxSize()) + "." + " Consider creating a new directory containing " + "only the content you wish to deploy.");
} else {
if (files.getDirList() == null || files.getDirList().length() == 0) {
indicator.onError("Could not determine the list of " + "files to deploy.");
indicator.onCompleted();
}
setFileList(JsArrayUtil.fromJsArrayString(files.getDirList()), fromPrevious_ != null ? fromPrevious_.getAdditionalFiles() : null, fromPrevious_ != null ? fromPrevious_.getIgnoredFiles() : null);
if (!source_.isWebsiteRmd())
setPrimaryFile(FileSystemItem.createFile(source_.getDeployFile()).getName());
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
indicator.clearProgress();
}
});
}
@Override
public void onError(ServerError error) {
// we need to have a list of files to deploy to proceed
indicator.onError("Could not find files to deploy: \n\n" + error.getMessage());
indicator.onCompleted();
}
});
}
Aggregations