< prev index next >
src/org/netbeans/jemmy/operators/JFileChooserOperator.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 41,50 ****
--- 41,51 ----
import javax.swing.JList;
import javax.swing.JTable;
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;
import javax.swing.plaf.FileChooserUI;
import javax.swing.table.TableModel;
*** 338,347 ****
--- 339,355 ----
* Returns either a JList or JTable, depending on the implementation.
*
* @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
+ if (UIManager.getLookAndFeel().getID().equals("Motif")
+ || UIManager.getLookAndFeel().getID().equals("GTK")) {
+ index =1;
+ }
return innerSearcher.
findComponent(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return (comp != null
*** 355,365 ****
@Override
public String toString() {
return "JFileChooserOperator.getFileList.ComponentChooser{description = " + getDescription() + '}';
}
! });
}
/**
* Pushes approve button.
*/
--- 363,373 ----
@Override
public String toString() {
return "JFileChooserOperator.getFileList.ComponentChooser{description = " + getDescription() + '}';
}
! }, index);
}
/**
* Pushes approve button.
*/
*** 431,441 ****
*/
public File goHome() {
getQueueTool().waitEmpty();
output.printTrace("Go home in JFileChooser\n : "
+ toStringSource());
! JButtonOperator homeOper = new JButtonOperator(getHomeButton());
homeOper.copyEnvironment(this);
homeOper.setOutput(output.createErrorOutput());
homeOper.push();
waitPainted(-1);
return getCurrentDirectory();
--- 439,457 ----
*/
public File goHome() {
getQueueTool().waitEmpty();
output.printTrace("Go home in JFileChooser\n : "
+ toStringSource());
! AbstractButtonOperator homeOper;
! // In Windows and Windows Classic L&F, there is no 'Go Home' button,
! // but there is a toggle button to go desktop. In Windows platform
! // 'Go Home' button usually navigates to Desktop only.
! if(UIManager.getLookAndFeel().getID().equals("Windows")) {
! homeOper =new JToggleButtonOperator(this, 1);
! } else {
! homeOper = new JButtonOperator(getHomeButton());
! }
homeOper.copyEnvironment(this);
homeOper.setOutput(output.createErrorOutput());
homeOper.push();
waitPainted(-1);
return getCurrentDirectory();
< prev index next >