Skip to content

Commit 0fcfb36

Browse files
fix deadlock when updating UI.
1 parent ee09ff7 commit 0fcfb36

File tree

1 file changed

+14
-12
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-guidance/src/main/java/com/microsoft/azure/toolkit/ide/guidance/view/components

1 file changed

+14
-12
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-guidance/src/main/java/com/microsoft/azure/toolkit/ide/guidance/view/components/PhasePanel.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,20 @@ public boolean show(IAzureMessage message) {
153153
}
154154

155155
private void updateStatus(Status status) {
156-
this.updateStatusIcon(status);
157-
this.updateView(status, this.detailsPanel.isVisible());
158-
final boolean focused = status == Status.READY || status == Status.RUNNING || status == Status.FAILED;
159-
this.actionButton.setEnabled(status == Status.READY || status == Status.FAILED);
160-
this.actionButton.setVisible(focused);
161-
final Color bgColor = focused ? BACKGROUND_COLOR : null;
162-
doForOffsprings(this.contentPanel, c -> c.setBackground(bgColor));
163-
doForOffsprings(this.inputsPanel, c -> c.setEnabled(status != Status.RUNNING && status != Status.SUCCEED));
164-
if (status == Status.FAILED) {
165-
this.actionButton.setText("Retry");
166-
this.toggleDetails(true);
167-
}
156+
UIUtil.invokeLaterIfNeeded(() -> {
157+
this.updateStatusIcon(status);
158+
this.updateView(status, this.detailsPanel.isVisible());
159+
final boolean focused = status == Status.READY || status == Status.RUNNING || status == Status.FAILED;
160+
this.actionButton.setEnabled(status == Status.READY || status == Status.FAILED);
161+
this.actionButton.setVisible(focused);
162+
final Color bgColor = focused ? BACKGROUND_COLOR : null;
163+
doForOffsprings(this.contentPanel, c -> c.setBackground(bgColor));
164+
doForOffsprings(this.inputsPanel, c -> c.setEnabled(status != Status.RUNNING && status != Status.SUCCEED));
165+
if (status == Status.FAILED) {
166+
this.actionButton.setText("Retry");
167+
this.toggleDetails(true);
168+
}
169+
});
168170
}
169171

170172
protected void paintComponent(@NotNull Graphics g) {

0 commit comments

Comments
 (0)