changeset 27:7f1077e65e78 tip

7902413: JFileChooserOperator - Filter file list based on accessible name instead of index Reviewed-by: shurailine Contributed-by: abdul.kolarkunnu@oracle.com
author akolarkunnu
date Tue, 05 Mar 2019 17:40:10 -0800
parents 464e600a2b0c
children
files src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java src/org/netbeans/jemmy/operators/JFileChooserOperator.java src/org/netbeans/jemmy/version_info
diffstat 3 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java	Fri Feb 15 13:09:00 2019 -0800
+++ b/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java	Tue Mar 05 17:40:10 2019 -0800
@@ -24,8 +24,6 @@
  */
 package org.netbeans.jemmy.drivers;
 
-import javax.swing.UIManager;
-
 import org.netbeans.jemmy.ClassReference;
 import org.netbeans.jemmy.JemmyException;
 import org.netbeans.jemmy.JemmyProperties;
--- a/src/org/netbeans/jemmy/operators/JFileChooserOperator.java	Fri Feb 15 13:09:00 2019 -0800
+++ b/src/org/netbeans/jemmy/operators/JFileChooserOperator.java	Tue Mar 05 17:40:10 2019 -0800
@@ -43,6 +43,7 @@
 import javax.swing.JTextField;
 import javax.swing.JToggleButton;
 import javax.swing.ListModel;
+import javax.swing.UIManager;
 import javax.swing.filechooser.FileFilter;
 import javax.swing.filechooser.FileSystemView;
 import javax.swing.filechooser.FileView;
@@ -341,18 +342,18 @@
      * @return a component being used to display directory content.
      */
     public Component getFileList() {
-        int index = 0;
-        // In GTK and Motif L&F, there are two JLists, one is to list folders
-        // and second one one is to list files
+        final String fileListName;
         if (LookAndFeel.isMotif() || LookAndFeel.isGTK()) {
-            index =1;
+            fileListName = UIManager.getString("FileChooser.filesLabelText", getLocale());
+        } else {
+            fileListName = UIManager.getString("FileChooser.filesListAccessibleName", getLocale());
         }
         return innerSearcher.
                 findComponent(new ComponentChooser() {
                     @Override
                     public boolean checkComponent(Component comp) {
-                        return (comp != null
-                                && (comp instanceof JList || comp instanceof JTable));
+                        return ((comp instanceof JList && fileListName.equals(comp.getAccessibleContext().getAccessibleName()))
+                                || comp instanceof JTable);
                     }
 
                     @Override
@@ -364,7 +365,7 @@
                     public String toString() {
                         return "JFileChooserOperator.getFileList.ComponentChooser{description = " + getDescription() + '}';
                     }
-                }, index);
+                });
     }
 
     /**
--- a/src/org/netbeans/jemmy/version_info	Fri Feb 15 13:09:00 2019 -0800
+++ b/src/org/netbeans/jemmy/version_info	Tue Mar 05 17:40:10 2019 -0800
@@ -1,6 +1,6 @@
 Manifest-version: 1.0
 Main-Class: org.netbeans.jemmy.JemmyProperties
 Jemmy-MajorVersion: 3.0
-Jemmy-MinorVersion: 8.0
+Jemmy-MinorVersion: 9.0
 Jemmy-Build: @BUILD_NUMBER@