Skip to content

Commit

Permalink
SLI-1426 Should use invokeLater with correct modality state
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Aug 28, 2024
1 parent cefae59 commit 7e2e308
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.components.JBTextArea;
import com.intellij.ui.components.fields.ExpandableTextField;
import com.intellij.util.ModalityUiUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.SwingHelper;
import com.intellij.util.ui.UIUtil;
Expand Down Expand Up @@ -288,11 +289,12 @@ public void load(SonarLintGlobalSettings settings) {

allRulesStateByKey.putAll(ruleNodes);

UIUtil.invokeLaterIfNeeded(() -> {
applyRuleSelection();
updateModel();
panel.stopLoading();
});
ModalityUiUtil.invokeLaterIfNeeded(
ModalityState.stateForComponent(panel), () -> {
applyRuleSelection();
updateModel();
panel.stopLoading();
});
})
.exceptionally(error -> {
GlobalLogOutput.get().log("Could not load rules: " + error.getMessage(), ClientLogOutput.Level.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@

import com.intellij.icons.AllIcons;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.ui.AbstractPainter;
import com.intellij.openapi.wm.IdeGlassPaneUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ModalityUiUtil;
import java.awt.Component;
import java.awt.Graphics2D;
import java.util.HashSet;
Expand All @@ -47,7 +48,8 @@ public void executePaint(Component component, Graphics2D g) {

public void installOn(JPanel component, Disposable disposable) {
this.panel = component;
UIUtil.invokeLaterIfNeeded(() -> IdeGlassPaneUtil.installPainter(component, this, disposable));
ModalityUiUtil.invokeLaterIfNeeded(ModalityState.stateForComponent(component),
() -> IdeGlassPaneUtil.installPainter(component, this, disposable));
}

public void addComponentWithErrors(JComponent component) {
Expand Down

0 comments on commit 7e2e308

Please sign in to comment.