Author: kono
Date: 2011-07-07 15:16:48 -0700 (Thu, 07 Jul 2011)
New Revision: 26106

Modified:
   
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/swing-application-api/trunk/src/main/java/org/cytoscape/application/swing/AbstractCyAction.java
Log:
fixes #113 New state networkWithoutView had been added.  If this metadata is in 
the xml file, the menu item will be enabled only when there is a network 
without view.

Modified: 
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
       2011-07-07 22:12:06 UTC (rev 26105)
+++ 
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
       2011-07-07 22:16:48 UTC (rev 26106)
@@ -508,7 +508,7 @@
                        <entry key="title" value="Create View" />
                        <entry key="preferredMenu" value="Edit" />
                        <entry key="menuGravity" value="3.0" />
-                       <entry key="enableFor" value="network" />
+                       <entry key="enableFor" value="networkWithoutView" />
                        <entry key="scope" value="limited" />
                </osgi:service-properties>
        </osgi:service>

Modified: 
core3/swing-application-api/trunk/src/main/java/org/cytoscape/application/swing/AbstractCyAction.java
===================================================================
--- 
core3/swing-application-api/trunk/src/main/java/org/cytoscape/application/swing/AbstractCyAction.java
       2011-07-07 22:12:06 UTC (rev 26105)
+++ 
core3/swing-application-api/trunk/src/main/java/org/cytoscape/application/swing/AbstractCyAction.java
       2011-07-07 22:16:48 UTC (rev 26106)
@@ -357,6 +357,8 @@
            setEnabled(true);
        else if (enableFor.equals("network"))
            enableForNetwork();
+       else if (enableFor.equals("networkWithoutView"))
+           enableForNetworkWithoutView();
        else if (enableFor.equals("networkAndView"))
            enableForNetworkAndView();
        else if (enableFor.equals("selectedNodesOrEdges"))
@@ -391,6 +393,17 @@
        else
            setEnabled(true);
     }
+    
+       protected void enableForNetworkWithoutView() {
+               final CyNetwork n = applicationManager.getCurrentNetwork();
+               final CyNetworkView v = 
applicationManager.getCurrentNetworkView();
+               if (n == null)
+                       setEnabled(false);
+               else if(n != null && v == null)
+                       setEnabled(true);
+               else
+                       setEnabled(false);
+       }
 
     /**
      * Enable the action if the current network and view exist and are not 
null.

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