Xcos start at same time of Scilab fixed. 13/16113/2
Cedric Delamarre [Mon, 9 Mar 2015 09:26:12 +0000 (10:26 +0100)]
Change-Id: If0aaf9bc1ed83f8e02987db3f23619252960ca32

scilab/modules/xcos/src/java/org/scilab/modules/xcos/Xcos.java

index abb9032..bebf717 100644 (file)
@@ -252,12 +252,16 @@ public final class Xcos {
     private static synchronized Xcos getInstance(final XcosTabFactory factory) {
         if (sharedInstance == null) {
             try {
-                SwingUtilities.invokeAndWait(new Runnable() {
-                    @Override
-                    public void run() {
-                        sharedInstance = new Xcos(factory);
-                    }
-                });
+                if (!SwingUtilities.isEventDispatchThread()) {
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        @Override
+                        public void run() {
+                            sharedInstance = new Xcos(factory);
+                        }
+                    });
+                } else {
+                    sharedInstance = new Xcos(factory);
+                }
             } catch (InvocationTargetException e) {
                 e.printStackTrace();
             } catch (InterruptedException e) {