use of org.rstudio.studio.client.rsconnect.model.RSConnectAccount in project rstudio by rstudio.
the class RSConnectDeploy method initialize.
@Inject
public void initialize(RSConnectServerOperations server, RSAccountConnector connector, GlobalDisplay display, UIPrefs prefs) {
server_ = server;
connector_ = connector;
display_ = display;
prefs_ = prefs;
accountList_ = new RSConnectAccountList(server_, display_, false, !asStatic_);
appName_ = new AppNameTextbox(this);
// when the account list finishes populating, select the account from the
// previous deployment if we have one
accountList_.setOnRefreshCompleted(new Operation() {
@Override
public void execute() {
if (fromPrevious_ != null) {
// when re-deploying, select the account used the last time
// around
accountList_.selectAccount(fromPrevious_.getAccount());
} else {
// when doing a first-time publish, select the account the user
// prefers (currently this just tracks the last account used)
RSConnectAccount preferred = prefs_.preferredPublishAccount().getGlobalValue();
if (preferred != null) {
accountList_.selectAccount(preferred);
}
// validate the app name now that we have an account selected
appName_.validateAppName();
}
}
});
// when the user selects a different account, show the appropriate UI
addAccountChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent arg0) {
if (fromPrevious_ != null) {
boolean existing = accountList_.getSelectedAccount().equals(fromPrevious_.getAccount());
appInfoPanel_.setVisible(existing);
newAppPanel_.setVisible(!existing);
// validate name if necessary
if (existing && onDeployEnabled_ != null)
onDeployEnabled_.execute();
else if (!existing)
appName_.validateAppName();
} else {
// re-validate app name as different accounts have different
// name restrictions
appName_.validateAppName();
}
}
});
}
use of org.rstudio.studio.client.rsconnect.model.RSConnectAccount in project rstudio by rstudio.
the class PublishingPreferencesPane method onDisconnect.
private void onDisconnect() {
final RSConnectAccount account = accountList_.getSelectedAccount();
if (account == null) {
display_.showErrorMessage("Error Disconnecting Account", "Please select an account to disconnect.");
return;
}
display_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Remove Account", "Are you sure you want to disconnect the '" + account.getName() + "' account on '" + account.getServer() + "'" + "? This won't delete the account on the server.", false, new Operation() {
@Override
public void execute() {
onConfirmDisconnect(account);
}
}, null, null, "Disconnect Account", "Cancel", false);
}
Aggregations