Author: kono
Date: 2011-10-20 15:34:50 -0700 (Thu, 20 Oct 2011)
New Revision: 27251

Modified:
   
core3/impl/trunk/psi-mi-impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabReader.java
Log:
Infinite loop problem fixed.

Modified: 
core3/impl/trunk/psi-mi-impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabReader.java
===================================================================
--- 
core3/impl/trunk/psi-mi-impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabReader.java
 2011-10-20 21:43:34 UTC (rev 27250)
+++ 
core3/impl/trunk/psi-mi-impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabReader.java
 2011-10-20 22:34:50 UTC (rev 27251)
@@ -26,6 +26,8 @@
        private final PsiMiTabParser parser;
        
        private CyNetwork network;
+       
+       private TaskMonitor parentTaskMonitor;
 
        public PsiMiTabReader(InputStream is,
                        CyNetworkViewFactory cyNetworkViewFactory,
@@ -41,6 +43,7 @@
 
        @Override
        public void run(TaskMonitor taskMonitor) throws Exception {
+               this.parentTaskMonitor = taskMonitor;
                try {
                        createNetwork(taskMonitor);
                } finally {
@@ -68,13 +71,20 @@
 
        @Override
        public CyNetworkView buildCyNetworkView(CyNetwork network) {
+
                final CyNetworkView view = 
cyNetworkViewFactory.getNetworkView(network);
 
-               CyLayoutAlgorithm tf = layouts.getDefaultLayout();
-               tf.setNetworkView(view);
-               TaskIterator ti = tf.getTaskIterator();
-               Task task = ti.next();
-               insertTasksAfterCurrentTask(task);
+               final CyLayoutAlgorithm layout = layouts.getDefaultLayout();
+               layout.setNetworkView(view);
+               
+               // Force to run this task here to avoid concurrency problem.
+               TaskIterator itr = layout.getTaskIterator();
+               Task nextTask = itr.next();
+               try {
+                       nextTask.run(parentTaskMonitor);
+               } catch (Exception e) {
+                       throw new RuntimeException("Could not finish layout", 
e);
+               }
 
                return view;
        }

-- 
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