Author: rozagh
Date: 2012-07-11 16:16:48 -0700 (Wed, 11 Jul 2012)
New Revision: 29848

Modified:
   
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
Log:
fixes #1261 the JOptionPane popped up for error message caused the problem. 

Modified: 
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
===================================================================
--- 
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
    2012-07-11 22:23:00 UTC (rev 29847)
+++ 
core3/impl/trunk/search-impl/src/main/java/org/cytoscape/search/internal/IndexAndSearchTask.java
    2012-07-11 23:16:48 UTC (rev 29848)
@@ -34,6 +34,7 @@
 import java.util.List;
 
 import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
 
 import org.apache.lucene.store.RAMDirectory;
 import org.cytoscape.application.CyApplicationManager;
@@ -79,7 +80,7 @@
 
        @Override
        public void run(final TaskMonitor taskMonitor) {
-               
+                               
                logger.debug("Index and search start.");
                
                // Give the task a title.
@@ -116,6 +117,7 @@
                
                showResults(queryHandler, taskMonitor);
                updateView();
+               
        }
 
        /**
@@ -139,16 +141,22 @@
        private void showResults(final EnhancedSearchQuery queryHandler, final 
TaskMonitor taskMonitor) {
                if (network == null || network.getNodeList().size() == 0)
                        return;
-               
+
                int nodeHitCount = queryHandler.getNodeHitCount();
                int edgeHitCount = queryHandler.getEdgeHitCount();
                if (nodeHitCount == 0 && edgeHitCount == 0) {
                        taskMonitor.setStatusMessage("Could not find any 
match.");
                        taskMonitor.setTitle("Search Finished");
                        taskMonitor.setProgress(1.0);
-                       
-                       JOptionPane
-                                       .showMessageDialog(null, "Could not 
find any matches.", "No Match.", JOptionPane.WARNING_MESSAGE);
+
+                       SwingUtilities.invokeLater(new Runnable() {
+                               @Override
+                               public void run() {
+                                       JOptionPane
+                                       .showMessageDialog(null, "Could not 
find any matches.", "No Match", JOptionPane.WARNING_MESSAGE);
+                                       logger.warn("Could not find any 
matches.");
+                               }
+                       });
                        return;
                }
 

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