private void display(final GeneralPreferences prefs) { AccountApi.self() .view("oauthtoken") .get( new GerritCallback<OAuthTokenInfo>() { @Override public void onSuccess(OAuthTokenInfo tokenInfo) { tokenLabel.setText(tokenInfo.accessToken()); expiresLabel.setText(getExpiresAt(tokenInfo, prefs)); netrcValue.setText(getNetRC(tokenInfo)); cookieValue.setText(getCookie(tokenInfo)); flow.setVisible(true); expiredNote.setVisible(false); } @Override public void onFailure(Throwable caught) { if (isNoSuchEntity(caught) || isSigninFailure(caught)) { tokenLabel.setText(""); expiresLabel.setText(""); netrcValue.setText(""); cookieValue.setText(""); flow.setVisible(false); expiredNote.setVisible(true); } else { showFailure(caught); } } }); }
@Override protected void onLoad() { super.onLoad(); AccountApi.self() .view("preferences") .get( new ScreenLoadCallback<GeneralPreferences>(this) { @Override protected void preDisplay(GeneralPreferences prefs) { display(prefs); } }); }