File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 31
31
import processing .app .helpers .OSUtils ;
32
32
import processing .app .helpers .PreferencesMapException ;
33
33
import processing .app .packages .UserLibrary ;
34
- import static processing .app .I18n ._ ;
35
34
36
35
import javax .swing .*;
37
36
import java .awt .*;
38
37
import java .io .File ;
39
- import java .io .FilenameFilter ;
40
38
import java .io .IOException ;
41
39
import java .util .Arrays ;
42
40
import java .util .LinkedList ;
43
41
import java .util .List ;
44
42
43
+ import static processing .app .I18n ._ ;
44
+
45
45
46
46
/**
47
47
* Stores information about files in the current sketch
@@ -999,7 +999,15 @@ private void setCurrentCode(int which, boolean forceUpdate) {
999
999
current = (SketchCodeDocument ) data .getCode (which ).getMetadata ();
1000
1000
currentIndex = which ;
1001
1001
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
+ }
1003
1011
1004
1012
editor .header .rebuild ();
1005
1013
}
You can’t perform that action at this time.
0 commit comments