Skip to content

Commit 09e2fed

Browse files
author
Federico Fissore
committed
Commit a9d10e0 may have caused issues when using IDE CLI
1 parent 110a6e2 commit 09e2fed

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/src/processing/app/Sketch.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
import processing.app.helpers.OSUtils;
3232
import processing.app.helpers.PreferencesMapException;
3333
import processing.app.packages.UserLibrary;
34-
import static processing.app.I18n._;
3534

3635
import javax.swing.*;
3736
import java.awt.*;
3837
import java.io.File;
39-
import java.io.FilenameFilter;
4038
import java.io.IOException;
4139
import java.util.Arrays;
4240
import java.util.LinkedList;
4341
import java.util.List;
4442

43+
import static processing.app.I18n._;
44+
4545

4646
/**
4747
* Stores information about files in the current sketch
@@ -999,7 +999,15 @@ private void setCurrentCode(int which, boolean forceUpdate) {
999999
current = (SketchCodeDocument) data.getCode(which).getMetadata();
10001000
currentIndex = which;
10011001

1002-
SwingUtilities.invokeLater(() -> editor.setCode(current));
1002+
if (SwingUtilities.isEventDispatchThread()) {
1003+
editor.setCode(current);
1004+
} else {
1005+
try {
1006+
SwingUtilities.invokeAndWait(() -> editor.setCode(current));
1007+
} catch (Exception e) {
1008+
e.printStackTrace();
1009+
}
1010+
}
10031011

10041012
editor.header.rebuild();
10051013
}

0 commit comments

Comments
 (0)