Author: clopes
Date: 2011-09-16 11:54:21 -0700 (Fri, 16 Sep 2011)
New Revision: 26840

Modified:
   
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
   
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
   
csplugins/trunk/toronto/clopes/mcode/src/main/resources/META-INF/spring/bundle-context-osgi.xml
Log:
Fixed incorrect file filter name and changed the analyze action to be enabled 
when there is a network, not a network view.

Modified: 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
===================================================================
--- 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
     2011-09-16 05:03:14 UTC (rev 26839)
+++ 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
     2011-09-16 18:54:21 UTC (rev 26840)
@@ -23,12 +23,12 @@
 import org.cytoscape.mcode.internal.view.MCODEResultsPanel;
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNode;
+import org.cytoscape.model.events.NetworkAddedEvent;
+import org.cytoscape.model.events.NetworkAddedListener;
+import org.cytoscape.model.events.NetworkDestroyedEvent;
+import org.cytoscape.model.events.NetworkDestroyedListener;
 import org.cytoscape.service.util.CyServiceRegistrar;
 import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.model.events.NetworkViewAddedEvent;
-import org.cytoscape.view.model.events.NetworkViewAddedListener;
-import org.cytoscape.view.model.events.NetworkViewDestroyedEvent;
-import org.cytoscape.view.model.events.NetworkViewDestroyedListener;
 import org.cytoscape.work.TaskManager;
 
 /**
@@ -70,8 +70,8 @@
 /**
  * Simple score and find action for MCODE. This should be the default for 
general users.
  */
-public class MCODEAnalyzeAction extends AbstractMCODEAction implements 
NetworkViewAddedListener,
-               NetworkViewDestroyedListener {
+public class MCODEAnalyzeAction extends AbstractMCODEAction implements 
NetworkAddedListener,
+               NetworkDestroyedListener {
 
        private static final long serialVersionUID = 87924889404093104L;
 
@@ -96,8 +96,9 @@
                this.registrar = registrar;
                this.taskManager = taskManager;
                this.mcodeUtil = mcodeUtil;
-
-               enableFor = "networkAndView";
+               
+               // The analysis should be disabled when there is no network
+               enableFor = "network";
        }
 
        /**
@@ -216,58 +217,49 @@
 
                                @Override
                                public void handleEvent(final 
AnalysisCompletedEvent e) {
-                                       SwingUtilities.invokeLater(new 
Runnable() {
+                                       MCODEResultsPanel resultsPanel = null;
+                                       boolean resultFound = false;
 
-                                               @Override
-                                               public void run() {
-                                                       MCODEResultsPanel 
resultsPanel = null;
-                                                       boolean resultFound = 
false;
+                                       // Display clusters in a new modal 
dialog box
+                                       if (e.isSuccessful()) {
+                                               if (e.getClusters() != null && 
e.getClusters().length > 0) {
+                                                       resultFound = true;
+                                                       
mcodeUtil.addNetworkResult(network.getSUID());
 
-                                                       // Display clusters in 
a new modal dialog box
-                                                       if (e.isSuccessful()) {
-                                                               if 
(e.getClusters() != null && e.getClusters().length > 0) {
-                                                                       
resultFound = true;
-                                                                       
mcodeUtil.addNetworkResult(network.getSUID());
+                                                       
MCODEDiscardResultAction discardResultAction = new MCODEDiscardResultAction(
+                                                                               
                                                                                
                                                "Discard Result",
+                                                                               
                                                                                
                                                resultId,
+                                                                               
                                                                                
                                                applicationManager,
+                                                                               
                                                                                
                                                swingApplication,
+                                                                               
                                                                                
                                                registrar,
+                                                                               
                                                                                
                                                mcodeUtil);
 
-                                                                       
MCODEDiscardResultAction discardResultAction = new MCODEDiscardResultAction(
-                                                                               
                                                                                
                                                                "Discard 
Result",
-                                                                               
                                                                                
                                                                resultId,
-                                                                               
                                                                                
                                                                
applicationManager,
-                                                                               
                                                                                
                                                                
swingApplication,
-                                                                               
                                                                                
                                                                registrar,
-                                                                               
                                                                                
                                                                mcodeUtil);
+                                                       resultsPanel = new 
MCODEResultsPanel(e.getClusters(), alg, mcodeUtil, network, networkView,
+                                                                               
                                                 e.getImageList(), resultId, 
swingApplication,
+                                                                               
                                                 discardResultAction);
 
-                                                                       
resultsPanel = new MCODEResultsPanel(e.getClusters(), alg, mcodeUtil, network,
-                                                                               
                                                                networkView, 
e.getImageList(), resultId,
-                                                                               
                                                                
swingApplication, discardResultAction);
+                                                       
registrar.registerService(resultsPanel, CytoPanelComponent.class, new 
Properties());
+                                               } else {
+                                                       
JOptionPane.showMessageDialog(swingApplication.getJFrame(),
+                                                                               
                                  "No clusters were found.\n"
+                                                                               
                                                  + "You can try changing the 
MCODE parameters or\n"
+                                                                               
                                                  + "modifying your node 
selection if you are using\n"
+                                                                               
                                                  + "a selection-specific 
scope.",
+                                                                               
                                  "No Results",
+                                                                               
                                  JOptionPane.WARNING_MESSAGE);
+                                               }
+                                       }
 
-                                                                       
registrar.registerService(resultsPanel, CytoPanelComponent.class, new 
Properties());
-                                                               } else {
-                                                                       
JOptionPane
-                                                                               
        .showMessageDialog(swingApplication.getJFrame(),
-                                                                               
                                           "No clusters were found.\n"
-                                                                               
                                                           + "You can try 
changing the MCODE parameters or\n"
-                                                                               
                                                           + "modifying your 
node selection if you are using\n"
-                                                                               
                                                           + "a 
selection-specific scope.",
-                                                                               
                                           "No Results",
-                                                                               
                                           JOptionPane.WARNING_MESSAGE);
-                                                               }
-                                                       }
+                                       CytoPanel cytoPanel = 
swingApplication.getCytoPanel(CytoPanelName.EAST);
 
-                                                       CytoPanel cytoPanel = 
swingApplication.getCytoPanel(CytoPanelName.EAST);
+                                       // This if statement ensures that the 
east cytopanel is not loaded if there are no results in it
+                                       if (resultFound || (analyze == 
INTERRUPTION && cytoPanel.indexOfComponent(resultsPanel) >= 0)) {
+                                               // Focus the result panel
+                                               int index = 
cytoPanel.indexOfComponent(resultsPanel);
+                                               
cytoPanel.setSelectedIndex(index);
 
-                                                       // This if statement 
ensures that the east cytopanel is not loaded if there are no results in it
-                                                       if (resultFound ||
-                                                               (analyze == 
INTERRUPTION && cytoPanel.indexOfComponent(resultsPanel) >= 0)) {
-                                                               // Focus the 
result panel
-                                                               int index = 
cytoPanel.indexOfComponent(resultsPanel);
-                                                               
cytoPanel.setSelectedIndex(index);
-
-                                                               if 
(cytoPanel.getState() == CytoPanelState.HIDE)
-                                                                       
cytoPanel.setState(CytoPanelState.DOCK);
-                                                       }
-                                               }
-                                       });
+                                               if (cytoPanel.getState() == 
CytoPanelState.HIDE) cytoPanel.setState(CytoPanelState.DOCK);
+                                       }
                                }
                        };
 
@@ -279,12 +271,12 @@
        }
 
        @Override
-       public void handleEvent(NetworkViewAddedEvent e) {
+       public void handleEvent(NetworkAddedEvent e) {
                updateEnableState();
        }
 
        @Override
-       public void handleEvent(NetworkViewDestroyedEvent e) {
+       public void handleEvent(NetworkDestroyedEvent e) {
                updateEnableState();
        }
 }

Modified: 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
===================================================================
--- 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
 2011-09-16 05:03:14 UTC (rev 26839)
+++ 
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
 2011-09-16 18:54:21 UTC (rev 26840)
@@ -690,7 +690,7 @@
                try {
                        // Call save method in MCODE get the file name
                        Collection<FileChooserFilter> filters = new 
ArrayList<FileChooserFilter>();
-                       filters.add(new FileChooserFilter("BioPAX format", 
"txt"));
+                       filters.add(new FileChooserFilter("Text format", 
"txt"));
                        File file = 
fileUtil.getFile(swingApplication.getJFrame(),
                                                                                
 "Export Graph as Interactions",
                                                                                
 FileUtil.SAVE,

Modified: 
csplugins/trunk/toronto/clopes/mcode/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
csplugins/trunk/toronto/clopes/mcode/src/main/resources/META-INF/spring/bundle-context-osgi.xml
     2011-09-16 05:03:14 UTC (rev 26839)
+++ 
csplugins/trunk/toronto/clopes/mcode/src/main/resources/META-INF/spring/bundle-context-osgi.xml
     2011-09-16 18:54:21 UTC (rev 26840)
@@ -89,8 +89,8 @@
     
     <osgi:service id="analyzeActionService" ref="analyzeAction">
         <osgi:interfaces>
-            
<value>org.cytoscape.view.model.events.NetworkViewAddedListener</value>
-            
<value>org.cytoscape.view.model.events.NetworkViewDestroyedListener</value>
+            <value>org.cytoscape.model.events.NetworkAddedListener</value>
+            <value>org.cytoscape.model.events.NetworkDestroyedListener</value>
          </osgi:interfaces>
     </osgi:service>
     

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