JDK-8081722 : Provide public access to sun.awt.shell.ShellFolder methods which are required for implementing javax.swing.JFileChooser
  • Type: Enhancement
  • Component: client-libs
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-06-02
  • Updated: 2017-09-13
  • Resolved: 2016-02-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b110Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
sun.awt.shell.ShellFolder is used by file chooser view to provide a special file view hierarchy. But there is no public API to retrieve this file hierarchy, when someone needs to implement their own file chooser, or display the user-familiar file hierarchy for whatever reason. This is especially needed on Windows OS.

Methods that are most needed are:
ShellFolder.getShellFolder(File file)
ShellFolder.getLinkLocation()
ShellFolder.get("fileChooserComboBoxFolders") - which provides the interesting roots.

Comments
NB: Semyon, the test will fail on jake.
04-03-2016

Pending review (Sergey, Phil)
15-02-2016

Then,probably, NetBeans team will have to migrate to the new API as other users?
09-09-2015

There are some places where the ShellFolder is used in NetBeans: http://hg.netbeans.org/main-silver/file/8ad7d894e168/dlight.remote/src/org/netbeans/modules/remote/api/ui/FileChooserUIImpl.java http://hg.netbeans.org/main-silver/file/8ad7d894e168/o.n.swing.dirchooser/src/org/netbeans/swing/dirchooser/DirectoryChooserUI.java
09-09-2015

A Question: there are yet another class sun.awt.shell.ShellFolderColumnInfo. It is used to create the detailed file view. Is it necessary to make it public as well? As a solution for this request I propose to introduce a new public class java.awt.shell.Folder containing the methods which are accessible and derive the ShellFolder from it instead of the File class: public abstract class Folder extends File { public Folder(String pathname) { super(pathname); } /** * @return Whether this shell folder is a link */ public abstract boolean isLink(); /** * @return The shell folder linked to by this shell folder, or null * if this shell folder is not a link */ public abstract Folder getLinkLocation() throws FileNotFoundException; /** * @return The name used to display this shell folder */ public abstract String getDisplayName(); /** * @return The type of shell folder as a string */ public abstract String getFolderType(); /** * @return The executable type as a string */ public abstract String getExecutableType(); public static Object get(String key) { return sun.awt.shell.ShellFolder.get(key); } public static File getNormalizedFile(File file) throws IOException { return sun.awt.shell.ShellFolder.getNormalizedFile(file); } public static Folder getShellFolder(File file) throws FileNotFoundException { return sun.awt.shell.ShellFolder.getShellFolder(file); } }
09-09-2015

Yes, it is the aim of this issue.
09-09-2015

One suggestion is to create a "desktop file system provider" that plugin in the file system service provider interface.
02-06-2015