diff options
author | Roman Kennke <roman@kennke.org> | 2006-08-02 11:31:42 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2006-08-02 11:31:42 +0000 |
commit | 96e691c80b4df8929bf41dded5119b067ab7524c (patch) | |
tree | 74bc82045bb91a31e52af6a2cc52f7fa822a9d13 /javax/swing/filechooser/UnixFileSystemView.java | |
parent | 376fefd18a289818077838e682923fc3930bc969 (diff) | |
download | classpath-96e691c80b4df8929bf41dded5119b067ab7524c.tar.gz |
2006-08-02 Roman Kennke <kennke@aicas.com>
PR 27604
* javax/swing/plaf/basic/BasicChooserUI.java
(BasicFileView.getName): Fetch the real name from the
file chooser's FileSystemView.
* javax/swing/plaf/metal/MetalChooserUI.java
(DirectoryComboBoxRenderer.getListCellRendererComponent):
Set the text fetched from the JFileChooser.getName().
* javax/swing/FileSystemView.java
(createFileObject): When file is a filesystem root,
create a filesystem root object first.
(getSystemDisplayName): Return the filename. Added specnote
about ShellFolder class that is mentioned in the spec.
* javax/swing/UnixFileSystemView.java
(getSystemDisplayName): Implemented to return the real name
of a file, special handling files like '.' or '..'.
Diffstat (limited to 'javax/swing/filechooser/UnixFileSystemView.java')
-rw-r--r-- | javax/swing/filechooser/UnixFileSystemView.java | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/javax/swing/filechooser/UnixFileSystemView.java b/javax/swing/filechooser/UnixFileSystemView.java index 96dfd2e1b..f8d71e1df 100644 --- a/javax/swing/filechooser/UnixFileSystemView.java +++ b/javax/swing/filechooser/UnixFileSystemView.java @@ -106,17 +106,34 @@ class UnixFileSystemView extends FileSystemView /** * Returns the name of a file as it would be displayed by the underlying - * system. This method is NOT YET IMPLEMENTED. + * system. * * @param f the file. * - * @return <code>null</code>. + * @return the name of a file as it would be displayed by the underlying + * system */ public String getSystemDisplayName(File f) - throws NotImplementedException { - // FIXME: Implement; - return null; + String name = null; + if (f != null) + { + if (isRoot(f)) + name = f.getAbsolutePath(); + else + { + try + { + String path = f.getCanonicalPath(); + name = path.substring(path.lastIndexOf(File.separator) + 1); + } + catch (IOException e) + { + name = f.getName(); + } + } + } + return name; } /** |