Skip to content

Commit 297b9ac

Browse files
authored
Merge pull request #6141 from microsoft/andy-fix-sp
fix eclipse ui thread issue for sp: Widget is disposed
2 parents bca7983 + 55ade7d commit 297b9ac

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.core/src/com/microsoft/azuretools/core/handlers/SignInCommandHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,17 @@ private static AuthConfiguration showSignInWindowAndGetAuthConfiguration(Shell p
131131

132132
AuthConfiguration auth = dialog.getData();
133133
if (auth.getType() == AuthType.SERVICE_PRINCIPAL) {
134+
CompletableFuture<AuthConfiguration> future = new CompletableFuture<>();
134135
ServicePrincipalLoginDialog servicePrincipalLoginDialog = new ServicePrincipalLoginDialog(parentShell);
136+
servicePrincipalLoginDialog.setOkActionListener(value -> {
137+
future.complete(value);
138+
servicePrincipalLoginDialog.close();
139+
});
140+
135141
if (servicePrincipalLoginDialog.open() == Window.CANCEL) {
136142
throw new InterruptedException("user cancel");
137143
}
138-
auth = servicePrincipalLoginDialog.getForm().getValue();
144+
auth = future.getNow(null);
139145
}
140146
return auth;
141147
}

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.core/src/com/microsoft/azuretools/core/ui/SignInDialog.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ private void disableAzureCliLogin() {
160160

161161
private Button createRadioButton(Composite parent, String label, AuthType type) {
162162
final Button radioButton = new Button(parent, SWT.RADIO);
163+
radioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
163164
radioButton.addSelectionListener(new SelectionAdapter() {
164165
@Override
165166
public void widgetSelected(SelectionEvent e) {

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.core/src/com/microsoft/azuretools/core/ui/login/ServicePrincipalLoginDialog.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,25 +309,25 @@ protected void checkSubclass() {
309309
public AuthConfiguration getValue() {
310310
AuthConfiguration data = new AuthConfiguration();
311311

312-
data.setClient(txtClientId.getText());
313-
data.setTenant(txtTenantId.getText());
312+
data.setClient(txtClientId.getValue());
313+
data.setTenant(txtTenantId.getValue());
314314
if (radioPassword.getSelection()) {
315-
data.setKey(txtPassword.getText());
315+
data.setKey(txtPassword.getValue());
316316
} else {
317-
data.setCertificate(this.txtCertificate.getText());
317+
data.setCertificate(this.txtCertificate.getValue());
318318
}
319319
data.setType(AuthType.SERVICE_PRINCIPAL);
320320
return data;
321321
}
322322

323323
@Override
324324
public void setValue(AuthConfiguration model) {
325-
this.txtTenantId.setText(StringUtils.defaultString(model.getTenant()));
326-
this.txtClientId.setText(StringUtils.defaultString(model.getClient()));
325+
this.txtTenantId.setValue(StringUtils.defaultString(model.getTenant()));
326+
this.txtClientId.setValue(StringUtils.defaultString(model.getClient()));
327327

328328
if (!StringUtils.isAllBlank(model.getCertificate(), model.getKey())) {
329329
if (model.getKey() != null) {
330-
this.txtPassword.setText(model.getKey());
330+
this.txtPassword.setValue(model.getKey());
331331
this.radioPassword.setSelection(true);
332332
this.radioCertificate.setSelection(false);
333333
} else {

0 commit comments

Comments
 (0)