File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 3131import processing .app .helpers .OSUtils ;
3232import processing .app .helpers .PreferencesMapException ;
3333import processing .app .packages .UserLibrary ;
34- import static processing .app .I18n ._ ;
3534
3635import javax .swing .*;
3736import java .awt .*;
3837import java .io .File ;
39- import java .io .FilenameFilter ;
4038import java .io .IOException ;
4139import java .util .Arrays ;
4240import java .util .LinkedList ;
4341import 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 }
You can’t perform that action at this time.
0 commit comments