Author: pwang
Date: 2011-07-12 16:55:45 -0700 (Tue, 12 Jul 2011)
New Revision: 26160

Modified:
   
core3/work-swing-impl/trunk/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
Log:
Restrict the use of filter "All image/network files" for saving only

Modified: 
core3/work-swing-impl/trunk/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
===================================================================
--- 
core3/work-swing-impl/trunk/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
        2011-07-12 23:50:05 UTC (rev 26159)
+++ 
core3/work-swing-impl/trunk/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
        2011-07-12 23:55:45 UTC (rev 26160)
@@ -190,20 +190,23 @@
                public void actionPerformed(ActionEvent ae) {
                                try_again:  {
        
-                               //We can not detect the filter current used, so 
we we use filter "All image files" or 
-                               //"All network files" for the cases of image 
export or network export
-                               FileChooserFilter filter = null;
-                               for (int i=0; i<filters.size(); i++){
-                                       filter = 
(FileChooserFilter)filters.get(i);
-                                       if 
(filter.getDescription().trim().equalsIgnoreCase("All image files") ||
-                                                       
filter.getDescription().trim().equalsIgnoreCase("All network files")){
-                                               filters = new ArrayList();
-                                               filters.add(filter);
-                                               break;
+                               final int load_or_save = input ? FileUtil.LOAD 
: FileUtil.SAVE;
+                               
+                               if (load_or_save == FileUtil.SAVE){
+                                       //In case of export, we can not detect 
the filter current used, so we we use filter "All image files" or 
+                                       //"All network files" when export image 
or network
+                                       FileChooserFilter filter = null;
+                                       for (int i=0; i<filters.size(); i++){
+                                               filter = 
(FileChooserFilter)filters.get(i);
+                                               if 
(filter.getDescription().trim().equalsIgnoreCase("All image files") ||
+                                                               
filter.getDescription().trim().equalsIgnoreCase("All network files")){
+                                                       filters = new 
ArrayList();
+                                                       filters.add(filter);
+                                                       break;
+                                               }
                                        }
                                }
-       
-                               final int load_or_save = input ? FileUtil.LOAD 
: FileUtil.SAVE;
+                               
                                final File file = 
fileUtil.getFile(SwingUtilities.getWindowAncestor(panel),
                                                titleLabel.getText(), 
load_or_save, filters);
                                if (file != 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