public LoginAdvancedControl(Composite parent, int style, AuthenticationRunner authenticator) { super(parent, style); this.authenticator = authenticator; Grid12 grid = new Grid12(this, 40, 20); grid.createLabel(4, Labels.getString("SettingsPage.username")); userName = grid.createText( 6, SWT.BORDER | SWT.FILL, authenticator.getConfig().getString(Config.USERNAME)); grid.createPadding(2); grid.createLabel(4, Labels.getString("SettingsPage.sessionId")); sessionId = grid.createText( 6, SWT.BORDER, authenticator.getConfig().getString(Config.SFDC_INTERNAL_SESSION_ID)); grid.createPadding(2); grid.createLabel(4, Labels.getString("SettingsPage.instServerUrl")); loginUrl = grid.createText(6, SWT.BORDER, authenticator.getConfig().getString(Config.ENDPOINT)); grid.createPadding(2); loginLabel = grid.createLabel(8, ""); loginButton = grid.createButton(2, SWT.PUSH | SWT.FILL, Labels.getString("SettingsPage.login")); loginButton.addListener(SWT.Selection, this::loginButton_Clicked); grid.createPadding(2); }
private void loginButton_Clicked(Event event) { LoginCriteria criteria = new LoginCriteria(LoginCriteria.Advanced); criteria.setInstanceUrl(loginUrl.getText()); criteria.setSessionId(sessionId.getText()); criteria.setUserName(userName.getText()); authenticator.login(criteria, loginLabel::setText); }