use of org.rstudio.studio.client.rsconnect.model.RSConnectPublishInput in project rstudio by rstudio.
the class RSConnect method showPublishUI.
private void showPublishUI(final RSConnectActionEvent event) {
final RSConnectPublishInput input = new RSConnectPublishInput(event);
// set these inside the wizard input so we don't need to pass around
// session/prefs
input.setConnectUIEnabled(pUiPrefs_.get().enableRStudioConnect().getGlobalValue());
input.setExternalUIEnabled(session_.getSessionInfo().getAllowExternalPublish());
input.setDescription(event.getDescription());
if (event.getFromPrevious() != null) {
switch(event.getContentType()) {
case CONTENT_TYPE_APP:
case CONTENT_TYPE_APP_SINGLE:
publishAsCode(event, null, true);
break;
case CONTENT_TYPE_PRES:
case CONTENT_TYPE_PLOT:
case CONTENT_TYPE_HTML:
case CONTENT_TYPE_DOCUMENT:
case CONTENT_TYPE_WEBSITE:
if (event.getFromPrevious().getServer().equals("rpubs.com")) {
publishAsRPubs(event);
} else {
fillInputFromDoc(input, event.getPath(), new CommandWithArg<RSConnectPublishInput>() {
@Override
public void execute(RSConnectPublishInput arg) {
if (arg == null)
return;
if (event.getFromPrevious().getAsStatic())
publishAsFiles(event, new RSConnectPublishSource(event.getPath(), event.getHtmlFile(), arg.getWebsiteDir(), arg.isSelfContained(), true, arg.isShiny(), arg.getDescription(), event.getContentType()));
else
publishAsCode(event, arg.getWebsiteDir(), arg.isShiny());
}
});
}
break;
}
} else {
// plots and HTML are implicitly self-contained
if (event.getContentType() == CONTENT_TYPE_PLOT || event.getContentType() == CONTENT_TYPE_HTML || event.getContentType() == CONTENT_TYPE_PRES) {
input.setIsSelfContained(true);
}
// if R Markdown, get info on what we're publishing from the server
if (event.getFromPreview() != null) {
input.setSourceRmd(FileSystemItem.createFile(event.getFromPreview().getSourceFile()));
fillInputFromDoc(input, event.getFromPreview().getSourceFile(), new CommandWithArg<RSConnectPublishInput>() {
@Override
public void execute(RSConnectPublishInput arg) {
showPublishUI(arg);
}
});
} else {
showPublishUI(input);
}
}
}
Aggregations