Author: mcreech
Date: 2010-02-02 17:05:19 -0800 (Tue, 02 Feb 2010)
New Revision: 19153

Modified:
   csplugins/trunk/agilent/Cytoscape/src/cytoscape/Cytoscape.java
Log:
Changed Cytoscape.exit() to exit differently for EMBEDDED_WINDOW mode.

Modified: csplugins/trunk/agilent/Cytoscape/src/cytoscape/Cytoscape.java
===================================================================
--- csplugins/trunk/agilent/Cytoscape/src/cytoscape/Cytoscape.java      
2010-02-02 21:51:36 UTC (rev 19152)
+++ csplugins/trunk/agilent/Cytoscape/src/cytoscape/Cytoscape.java      
2010-02-03 01:05:19 UTC (rev 19153)
@@ -448,10 +448,35 @@
                                if ((mode == CyInitParams.EMBEDDED_WINDOW) ||
                                    CyMain.isAGMode()) {
                                // MLC 12/08/09 END.
-                                       // don't system exit since we are 
running as part
-                                       // of a bigger application. Instead, 
dispose of the
-                                       // desktop.
-                                       getDesktop().dispose();
+                                   // MLC 02/02/10 BEGIN:
+                                   // We would like to just dispose
+                                   // of the desktop, but Cytoscape
+                                   // is not designed to create a new
+                                   // Cytoscape while another is
+                                   // still alive.  In other words,
+                                   // we can't just call 'CyMain.main
+                                   // (args)' and have a new
+                                   // Cytoscape that we can use. Many
+                                   // operations, like
+                                   // Cytoscape.getDesktop() just
+                                   // return a singleton instance
+                                   // that is now bound to the old
+                                   // desktop. To make matters worse,
+                                   // all the data content (mapping
+                                   // structures, nodes, networks)
+                                   // from previous usage is
+                                   // there. So our approach is to
+                                   // just make the existing desktop
+                                   // not visible and reset Cytoscape
+                                   // to a new session:
+                                   // // don't system exit since we are 
running as part
+                                   // // of a bigger application. Instead, 
dispose of the
+                                   // // desktop.
+                                   // getDesktop().dispose();
+                                   getDesktop().setVisible (false);
+                                   // get rid of existing data:
+                                   Cytoscape.createNewSession ();
+                                   // MLC 02/02/10 END.
                                } else {
                                        System.exit(returnVal);
                                }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to