use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class PackagesPane method setActions.
@Override
public void setActions(ArrayList<Packages.Action> actions) {
// command that manages the layout of the packages list and action center
Command manageActionCenterLayout = new Command() {
@Override
public void execute() {
resizeActionCenter();
}
};
if (actions == null || actions.size() == 0) {
if (actionCenter_ != null) {
packagesTableContainer_.remove(actionCenter_);
actionCenter_ = null;
layoutPackagesTable();
packagesTableContainer_.animate(ACTION_CENTER_ANIMATION_MS);
}
} else {
// in a non-collapsed center, raise the packages pane
if (actionCenter_ == null || ((!actionCenter_.collapsed()) && (actionCenter_.getActionCount() != actions.size()))) {
events_.fireEvent(new RaisePackagePaneEvent());
}
// create the action center if it doesn't already exist
if (actionCenter_ == null) {
actionCenter_ = new ActionCenter(manageActionCenterLayout);
packagesTableContainer_.add(actionCenter_);
}
actionCenter_.setActions(actions);
resizeActionCenter();
}
}
use of com.google.gwt.user.client.Command 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 com.google.gwt.user.client.Command in project rstudio by rstudio.
the class RSConnectPublishButton method renderThenPublish.
// for static content only: perform a just-in-time render if necessary and
// then publish the content
private void renderThenPublish(final String target, final RSConnectDeploymentRecord previous) {
// prevent re-entrancy
if (rmdInfoPending_)
return;
final Command renderCommand = new Command() {
@Override
public void execute() {
publishAfterRmdRender_ = previous;
rmdRenderPending_ = true;
anyRmdRenderPending_ = true;
if (commands_.knitDocument().isEnabled())
commands_.knitDocument().execute();
else if (commands_.previewHTML().isEnabled())
commands_.previewHTML().execute();
else
display_.showErrorMessage("Can't Render Document", "RStudio cannot render " + target + " for publishing.");
}
};
rmdInfoPending_ = true;
rmdServer_.getRmdOutputInfo(target, new ServerRequestCallback<RmdOutputInfo>() {
@Override
public void onResponseReceived(RmdOutputInfo response) {
if (response.isCurrent()) {
RenderedDocPreview preview = new RenderedDocPreview(target, response.getOutputFile(), true);
events_.fireEvent(RSConnectActionEvent.DeployDocEvent(preview, RSConnect.CONTENT_TYPE_DOCUMENT, previous));
} else {
renderCommand.execute();
}
rmdInfoPending_ = false;
}
@Override
public void onError(ServerError error) {
// if we failed to figure out whether we need to do a re-render,
// assume one is necessary
Debug.logError(error);
renderCommand.execute();
rmdInfoPending_ = false;
}
});
}
use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class SVNCommandHandler method onVcsRevert.
@Handler
void onVcsRevert() {
final ArrayList<String> paths = getPathArray();
if (paths.size() == 0)
return;
doRevert(paths, new Command() {
@Override
public void execute() {
display_.getChangelistTable().selectNextUnselectedItem();
display_.getChangelistTable().focus();
}
});
}
use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class ConnectionsPane method transitionMainPanel.
private void transitionMainPanel(final Widget from, final Widget to, boolean rightToLeft, boolean animate, final Command onComplete) {
assert from != to;
int width = getOffsetWidth();
mainPanel_.setWidgetLeftWidth(from, 0, Unit.PX, width, Unit.PX);
mainPanel_.setWidgetLeftWidth(to, rightToLeft ? width : -width, Unit.PX, width, Unit.PX);
mainPanel_.forceLayout();
mainPanel_.setWidgetLeftWidth(from, rightToLeft ? -width : width, Unit.PX, width, Unit.PX);
mainPanel_.setWidgetLeftWidth(to, 0, Unit.PX, width, Unit.PX);
to.setVisible(true);
from.setVisible(true);
final Command completeLayout = new Command() {
@Override
public void execute() {
mainPanel_.setWidgetLeftRight(to, 0, Unit.PX, 0, Unit.PX);
from.setVisible(false);
mainPanel_.forceLayout();
onComplete.execute();
}
};
if (animate) {
mainPanel_.animate(300, new AnimationCallback() {
public void onAnimationComplete() {
completeLayout.execute();
}
public void onLayout(Layer layer, double progress) {
}
});
} else {
completeLayout.execute();
}
}
Aggregations